HSF和Dubbo有什麽區別
阿新 • • 發佈:2017-07-18
rec string meta unit client 描述 模型 最新 這一
一、
以下摘錄自企業級分布式應用服務EDAS官網段落
1.dubbo測試結果:
note:
dubbo測試時有使用ZooKeeper,所以存在不公平性,不一定準確。
同步模型
耗時:16.808 s
平均:0.16808 ms
TPS:5949.547834364588
測試數據:
2.hsf 測試結果:
異步模型:
耗時:6.305 s
平均:0.06305 ms
TPS:15860.428231562253
測試數據:
同步模型:
耗時:9.446 s
平均:0.09446 ms
TPS:10586.491636671608
RPC服務提供對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完勝dubbo1.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有什麽區別