java轻量级服务框架,JRPC 轻量级RPC框架

Quick Start

step 1:

git clone https://github.com/dinstone/jrpc.git

step 2:

maven install.

step 3:

select transport implement,add 'mina' or 'netty' dependency:

com.dinstone.jrpc

jrpc-transport-mina

${jrpc.version}

or

com.dinstone.jrpc

jrpc-transport-netty4

${jrpc.version}

if you need service registry and discovery, please add dependencies :

com.dinstone.jrpc

jrpc-registry-zookeeper

${jrpc.version}

If you are integrated with Spring, please add dependencies :

com.dinstone.jrpc

jrpc-spring

${jrpc.version}

Example

For more details, please refer to the example project : jrpc-example

java programming by API

export service:

Server server = new Server("localhost", 4444);

ServiceExporter serviceExporter = server.getServiceExporter();

serviceExporter.exportService(HelloService.class, new HelloServiceImpl());

System.in.read();

server.destroy();

import service:

Client client = new Client("localhost", 4444);

ServiceImporter serviceImporter = client.getServiceImporter();

HelloService helloService = serviceImporter.importService(HelloService.class);

helloService.sayHello("dinstone");

client.destroy();

declarative programming by Spring

export service:

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.dinstone.com/schema/jrpc http://www.dinstone.com/schema/jrpc-3.0.xsd">

import service:

xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

http://www.dinstone.com/schema/jrpc http://www.dinstone.com/schema/jrpc-3.0.xsd">

Test Result

JVM Parameter

-server -Xmx1g -Xms1g -Xmn712m -XX:PermSize=128m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70

Case: Server[netty5] Client[netty5]

1 Threads, 500 Bytes, 4824 ms, AVG: 2072 tps

10 Threads, 500 Bytes, 17325 ms, AVG: 5772 tps

20 Threads, 500 Bytes, 13456 ms, AVG: 14863 tps

32 Threads, 500 Bytes, 11134 ms, AVG: 28740 tps

1 Threads, 1024 Bytes, 1101 ms, AVG: 9082 tps

10 Threads, 1024 Bytes, 5809 ms, AVG: 17214 tps

20 Threads, 1024 Bytes, 9108 ms, AVG: 21958 tps

32 Threads, 1024 Bytes, 14622 ms, AVG: 21884 tps

40 Threads, 1024 Bytes, 17692 ms, AVG: 22609 tps

Case: Server[netty5] Client[mina]

1 Threads, 500 Bytes, 994 ms, AVG: 10060 tps

10 Threads, 500 Bytes, 4516 ms, AVG: 22143 tps

20 Threads, 500 Bytes, 8555 ms, AVG: 23378 tps

32 Threads, 500 Bytes, 13801 ms, AVG: 23186 tps

1 Threads, 1024 Bytes, 1027 ms, AVG: 9737 tps

10 Threads, 1024 Bytes, 6488 ms, AVG: 15413 tps

20 Threads, 1024 Bytes, 12776 ms, AVG: 15654 tps

32 Threads, 1024 Bytes, 20318 ms, AVG: 15749 tps

40 Threads, 1024 Bytes, 26149 ms, AVG: 15296 tps

Case: Server[mina] Client[mina]

1 Threads, 500 Bytes, 919 ms, AVG: 10881 tps

10 Threads, 500 Bytes, 2437 ms, AVG: 41034 tps

20 Threads, 500 Bytes, 4149 ms, AVG: 48204 tps

32 Threads, 500 Bytes, 6694 ms, AVG: 47804 tps

1 Threads, 1024 Bytes, 957 ms, AVG: 10449 tps

10 Threads, 1024 Bytes, 3168 ms, AVG: 31565 tps

20 Threads, 1024 Bytes, 6071 ms, AVG: 32943 tps

32 Threads, 1024 Bytes, 9485 ms, AVG: 33737 tps

40 Threads, 1024 Bytes, 11735 ms, AVG: 34086 tps

Case: Server[mina] Client[netty5]

1 Threads, 500 Bytes, 1046 ms, AVG: 9560 tps

10 Threads, 500 Bytes, 5234 ms, AVG: 19105 tps

20 Threads, 500 Bytes, 6962 ms, AVG: 28727 tps

32 Threads, 500 Bytes, 9193 ms, AVG: 34809 tps

1 Threads, 1024 Bytes, 1096 ms, AVG: 9124 tps

10 Threads, 1024 Bytes, 5069 ms, AVG: 19727 tps

20 Threads, 1024 Bytes, 6591 ms, AVG: 30344 tps

32 Threads, 1024 Bytes, 10526 ms, AVG: 30400 tps

40 Threads, 1024 Bytes, 12216 ms, AVG: 32743 tps

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值