HSF和Dubbo有什么区别
2017-07-17 23:55
603 查看
一、
以下摘录自企业级分布式应用服务EDAS官网段落
来源:企业级分布式应用服务EDAS_企业云计算解决方案
二、
今天没什么事,简单测试下RPC框架性能: HSF完胜dubbo
1.dubbo测试结果:
note:
dubbo测试时有使用ZooKeeper,所以存在不公平性,不一定准确。
同步模型
耗时:16.808 s
平均:0.16808 ms
TPS:5949.547834364588
测试数据:
public class TPS_TEST {
public static void main(String[] args) throws InterruptedException {
final ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext(
new String[] {"file:E:/1-project_test/dubbox-master/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml"});
final HelloService helloService = (HelloService)context.getBean("helloService"); // get service invocation proxy
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
String hello = helloService.hello("aa"); // do invoke!
//System.out.println( hello ); // cool, how are you~
cdl.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
}
2.hsf 测试结果:
异步模型:
耗时:6.305 s
平均:0.06305 ms
TPS:15860.428231562253
测试数据:
public class Client {
public static void main(String[] args) throws InterruptedException, ExecutionException {
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
// final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncProxy(
// TestService.class);
HsfConnector connector = new HsfConnectorImpl();
connector.connect(new InetSocketAddress("localhost", 8082));
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncCallbackProxy(
TestService.class, new AsyncCallback<Object>() {
public void doCallback(Object data) {
//System.out.println("received:" + data);
cdl.countDown();
};
@Override
public void doExceptionCaught(Throwable ex, HsfChannel channel, Object param) {
System.out.println(ex);
super.doExceptionCaught(ex, channel, param);
}
});
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
testService.test("aa");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
}
同步模型:
耗时:9.446 s
平均:0.09446 ms
TPS:10586.491636671608
//tips:
//模拟HSF的同步模型:在10万个并发线程发送数据时有时候比异步模型还要快,这点有点想不通,估计是我测试的服务是直接return的场景吧。
/**
* @Title: Client.java
* @Description: TODO(添加描述)
* @date 2012-2-23 上午01:01:33
* @version V1.0
*/
public class Client2 {
public static void main(String[] args) throws InterruptedException, ExecutionException {
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
HsfConnector connector = new HsfConnectorImpl();
connector.connect(new InetSocketAddress("10.118.63.12", 10223));
/*
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncCallbackProxy(
TestService.class, new AsyncCallback<Object>() {
public void doCallback(Object data) {
//System.out.println("received:" + data);
cdl.countDown();
};
@Override
public void doExceptionCaught(Throwable ex, HsfChannel channel, Object param) {
System.out.println(ex);
super.doExceptionCaught(ex, channel, param);
}
});
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
testService.test("aa");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
*/
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapSyncProxy(
TestService.class);
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
String hello = testService.test("aa");
cdl.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
以下摘录自企业级分布式应用服务EDAS官网段落
RPC服务
提供对Dubbo和HSF两个RPC框架的支持。阿里巴巴第一代RPC框架Dubbo是国内第一款成熟的商用级RPC框架,已于2011年正式对外开源,目前已发展成为国内开源价值最高、用户使用规模最大的开源软件之一。最新一代RPC框架HSF,全称High Speed Framework,也叫"好舒服","很舒服"框架,是阿里内部对这一款高性能服务框架的昵称,是一款面向企业级互联网架构量身定制的分布式服务框架。HSF以高性能网络通信框架为基础,提供了诸如服务发布与注册,服务调用,服务路由,服务鉴权,服务限流,服务降级和服务调用链路跟踪等一系列久经考验的功能特性。
提供对Dubbo和HSF两个RPC框架的支持。阿里巴巴第一代RPC框架Dubbo是国内第一款成熟的商用级RPC框架,已于2011年正式对外开源,目前已发展成为国内开源价值最高、用户使用规模最大的开源软件之一。最新一代RPC框架HSF,全称High Speed Framework,也叫"好舒服","很舒服"框架,是阿里内部对这一款高性能服务框架的昵称,是一款面向企业级互联网架构量身定制的分布式服务框架。HSF以高性能网络通信框架为基础,提供了诸如服务发布与注册,服务调用,服务路由,服务鉴权,服务限流,服务降级和服务调用链路跟踪等一系列久经考验的功能特性。
来源:企业级分布式应用服务EDAS_企业云计算解决方案
二、
dubbo和S-HSF测试对比
转载 :http://www.cnblogs.com/langtianya/p/5720275.html#undefined今天没什么事,简单测试下RPC框架性能: HSF完胜dubbo
1.dubbo测试结果:
note:
dubbo测试时有使用ZooKeeper,所以存在不公平性,不一定准确。
同步模型
耗时:16.808 s
平均:0.16808 ms
TPS:5949.547834364588
测试数据:
public class TPS_TEST {
public static void main(String[] args) throws InterruptedException {
final ClassPathXmlApplicationContext context =
new ClassPathXmlApplicationContext(
new String[] {"file:E:/1-project_test/dubbox-master/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml"});
final HelloService helloService = (HelloService)context.getBean("helloService"); // get service invocation proxy
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
String hello = helloService.hello("aa"); // do invoke!
//System.out.println( hello ); // cool, how are you~
cdl.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
}
2.hsf 测试结果:
异步模型:
耗时:6.305 s
平均:0.06305 ms
TPS:15860.428231562253
测试数据:
public class Client {
public static void main(String[] args) throws InterruptedException, ExecutionException {
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
// final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncProxy(
// TestService.class);
HsfConnector connector = new HsfConnectorImpl();
connector.connect(new InetSocketAddress("localhost", 8082));
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncCallbackProxy(
TestService.class, new AsyncCallback<Object>() {
public void doCallback(Object data) {
//System.out.println("received:" + data);
cdl.countDown();
};
@Override
public void doExceptionCaught(Throwable ex, HsfChannel channel, Object param) {
System.out.println(ex);
super.doExceptionCaught(ex, channel, param);
}
});
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
testService.test("aa");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
}
同步模型:
耗时:9.446 s
平均:0.09446 ms
TPS:10586.491636671608
//tips:
//模拟HSF的同步模型:在10万个并发线程发送数据时有时候比异步模型还要快,这点有点想不通,估计是我测试的服务是直接return的场景吧。
/**
* @Title: Client.java
* @Description: TODO(添加描述)
* @date 2012-2-23 上午01:01:33
* @version V1.0
*/
public class Client2 {
public static void main(String[] args) throws InterruptedException, ExecutionException {
final int size = 100000;
final CountDownLatch cdl = new CountDownLatch(size);
HsfConnector connector = new HsfConnectorImpl();
connector.connect(new InetSocketAddress("10.118.63.12", 10223));
/*
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapAsyncCallbackProxy(
TestService.class, new AsyncCallback<Object>() {
public void doCallback(Object data) {
//System.out.println("received:" + data);
cdl.countDown();
};
@Override
public void doExceptionCaught(Throwable ex, HsfChannel channel, Object param) {
System.out.println(ex);
super.doExceptionCaught(ex, channel, param);
}
});
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
testService.test("aa");
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
*/
final TestService testService = ServiceProxyFactory.getRoundFactoryInstance(connector).wrapSyncProxy(
TestService.class);
ExecutorService executorServicePool = Executors.newFixedThreadPool(200);
long begin = System.currentTimeMillis();
for (int i = 0; i < size; i++) {
executorServicePool.execute(new Runnable() {
@Override
public void run() {
try {
String hello = testService.test("aa");
cdl.countDown();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
//executorServicePool.shutdown();
//executorService.awaitTermination(10, TimeUnit.MINUTES);
cdl.await();//等待所有任务处理完
long time = System.currentTimeMillis() - begin;
System.out.println("耗时:" + (double) time / 1000 + " s");
System.out.println("平均:" + ((double) time) / size +" ms");
System.out.println("TPS:" + (double) size / ((double) time / 1000));
}
相关文章推荐
- HSF和Dubbo有什么区别
- HSF和Dubbo有什么区别
- HSF和Dubbo有什么区别
- Dubbo&hsf&Spring-cloud的区别
- HSF和dubbo的区别
- 函数重载是什么意思?它与虚函数的概念有什么区别?
- JAVA中vector的remove和removeelementat这两个方法有什么区别?
- javascript与Java有什么区别
- ojdbc14.jar与classes12.jar有什么区别
- Hadoop与MPP是什么关系?有什么区别和联系?
- C++中"std::"是什么意思?起什么作用?namespace?iostream和iostream.h的区别
- KB、kb和MB、mb有什么区别
- 程序员在互联网公司和行业软件公司工作,有什么区别?
- nginx的反向代理和负载均衡的区别是什么
- dentry与inode有什么联系和区别
- linux里source、sh、bash、./有什么区别(转)
- 接口和抽象类有什么区别
- 【matlab】./和/ .*和* 有什么区别
- SQL server 2000 标准版、企业版、开发版、个人版有什么区别?
- oracle应用软件plsql中functions,procedures,packages有什么区别