HSF和Dubbo有什么区别
RPC服务
提供对Dubbo和HSF两个RPC框架的支持。阿里巴巴第一代RPC框架Dubbo是国内第一款成熟的商用级RPC框架,已于2011年正式对外开源,目前已发展成为国内开源价值最高、用户使用规模最大的开源软件之一。最新一代RPC框架HSF,全称High Speed Framework,也叫"好舒服","很舒服"框架,是阿里内部对这一款高性能服务框架的昵称,是一款面向企业级互联网架构量身定制的分布式服务框架。HSF以高性能网络通信框架为基础,提供了诸如服务发布与注册,服务调用,服务路由,服务鉴权,服务限流,服务降级和服务调用链路跟踪等一系列久经考验的功能特性。
dubbo和S-HSF测试对比
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有什么区别的更多相关文章
- RPC实现原理(HSF、dubbo) 从头开始(一)
前言 阔别了很久博客园,虽然看了以前写的很多东西感觉好幼稚,但是还是觉得应该把一些自己觉得有用的东西和大家分享.废话不多说,现在开始进入正题. 之前的六年工作经验,呆过了一些大公司,每个在大公司呆过的 ...
- 阿里巴巴为什么主推HSF?比Dubbo有哪些优势?
作者:匿名用户链接:https://www.zhihu.com/question/39560697/answer/187538165来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请 ...
- SpringCloud 和 Dubbo 有哪些区别?
首先,他们都是分布式管理框架. dubbo 是二进制传输,占用带宽会少一点.SpringCloud是http 传输,带宽会多一点,同时使用http协议一般会使用JSON报文,消耗会更大. ...
- Dubbo与Nginx区别
Dubbo的负载均衡已经是服务层面的了,和nginx的负载均衡还在http请求层面完全不同.至于二者哪个优秀,当然没办法直接比较. 涉及到负载均衡就涉及到你的业务,根据业务来选择才是最适合的. dub ...
- hsf
参考文章: ----- 架构和框架的区别 1.HSF源码剖析 2.Http和RPC区别 3.分布式服务框架HSF 4.高并发架构系列:如何从0到1设计一个类Dubbo的RPC框架 5.HSF的原理分析 ...
- dubbo&hsf&spring-cloud简单介绍
Dubbo: 简介:Dubbo是一个分布式服务框架,以及SOA治理方案.其功能主要包括:高性能NIO通讯及多协议集成,服务动态寻址与路由,软负载均衡与容错,依赖分析与降级等. 底部NIO基于netty ...
- Spring Cloud,Dubbo及HSF对比
Round 1:背景 Dubbo,是阿里巴巴服务化治理的核心框架,并被广泛应用于阿里巴巴集团的各成员站点.阿里巴巴近几年对开源社区的贡献不论在国内还是国外都是引人注目的,比如:JStorm捐赠给Apa ...
- 基于RPC原理的dubbo
在校期间大家都写过不少程序,比如写个hello world服务类,然后本地调用下,如下所示.这些程序的特点是服务消费方和服务提供方是本地调用关系. 而一旦踏入公司尤其是大型互联网公司就会发现,公司的系 ...
- Spring Cloud介绍 Spring Cloud与Dubbo对比
spring Cloud是一个基于Spring Boot实现的云应用开发工具,它为基于JVM的云应用开发中的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策竞选.分布式会话和集群状 ...
随机推荐
- 安装 Visual Studio Web Tools 的奇怪问题
安装Microsoft ASP.NET 5 RC 1 时提示 0x80070005 - 拒绝访问 日志文件为 [1968:3F64][2015-11-20T10:08:36]i010: Launchi ...
- 【2016-11-3】【坚持学习】【Day18】【我认识的ORM】
我学过或者用过的ORM有几种 EF NHibernate DevExpress xpo (第一家公司用这个,也是很省力的orm,现在已经不记得了.) 今天晚上想找一下有没有轻量级的orm: flue ...
- 有关sql server 2008无法导入数据库mdf文件的处理方法
解决方法1:根据该博客中的引导,加上自己安装版本的细节,可以添加成功 http://www.2cto.com/database/201408/328930.html 解决方法2: 根据<数据库系 ...
- MyBatis 智能标签
使用Where 只能标签 检索部门Y2162Dept 数据库已存在表Y2162Dept 实现动态查询 Deptno Deptname 赋值 不赋值 不赋值 赋值 赋值 赋值 不赋值 不赋值 <! ...
- 面试题:return和finally执行
创建一个包含return和finally的方法:(如下所示) public class Demo { public int get() { int x=1; try { x++; return x; ...
- Java面向对象 第一章 面向对象开发方法概述
一.软件开发经历的生命周期: ①软件分析 ②软件设计 ③软件编码 ④ 软件测试 ⑤ 软件部署 ⑥软件维护 二.为了提高软件开发效率,降低软件开发成本,一个优良的软件系统应该具备以下特点: ① 可重用性 ...
- Winform无边框窗体的移动和阴影
//窗体移动API [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport ...
- 生产环境使用 pt-table-checksum 检查MySQL数据一致性
公司数据中心从托管机房迁移到阿里云,需要对mysql迁移(Replication)后的数据一致性进行校验,但又不能对生产环境使用造成影响,pt-table-checksum 成为了绝佳也是唯一的检查工 ...
- Mysql更换MyISAM存储引擎为Innodb的操作记录
一般情况下,mysql会默认提供多种存储引擎,可以通过下面的查看: 1)查看mysql是否安装了innodb插件.通过下面的命令结果可知,已经安装了innodb插件. mysql> show p ...
- angular监听
监听中第三个参数,何时使用true? true的意思是“深度监听” 1.当监听对象属性变化时,而你监听的对象写得是对象,此时要用深度监听true: 2....... 监听耗资源,用完关闭 var wa ...