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的云应用开发中的配置管理.服务发现.断路器.智能路由.微代理.控制总线.全局锁.决策竞选.分布式会话和集群状 ...
随机推荐
- CentOS 7 虚拟机无法开机问题
若虚拟机在不正常关机的时候会遇到如下图所示的问题:先点击"取消"按钮
- AWS S3 CLI的权限bug
使用AWS CLI在S3上创建了一个bucket,上传文件的时候报以下错误: A client error (AccessDenied) occurred when calling the Creat ...
- codevs 1115 开心的金明--01背包
1115 开心的金明 2006年NOIP全国联赛普及组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 金明今天很开心,家里购 ...
- 洛谷P1196 银河英雄传说[带权并查集]
题目描述 公元五八○一年,地球居民迁移至金牛座α第二行星,在那里发表银河联邦 创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展. 宇宙历七九九年,银河系的两大军事集团在巴米利恩星域爆发战争.泰山 ...
- no-proxy 和proxy 的区别
Child <- many-to-one ->Parent class Child { private Parent paren ...
- Linux系统1.md
计算机 介绍 电子计算机(英语:computer),亦称电脑,是一种利用电子学原理,根据一系列指令对数据进行处理的工具. 在现代,机械计算机的应用已经完全被电子计算机所替换,其所相关的技术研究叫计算机 ...
- Python 过算符和数据类型
一.算术运算符 二.逻辑运算符
- <转>卷积神经网络是如何学习到平移不变的特征
After some thought, I do not believe that pooling operations are responsible for the translation inv ...
- 再谈Newtonsoft.Json高级用法
上一篇Newtonsoft.Json高级用法发布以后收到挺多回复的,本篇将分享几点挺有用的知识点和最近项目中用到的一个新点进行说明,做为对上篇文章的补充. 阅读目录 动态改变属性序列化名称 枚举值序列 ...
- mysql服务器监控参数总结
1)主机健康监控:网络通信.软硬件错误.磁盘空间.内存使用 2)mysql健康监控: 服务端口(telnet尝试连接).mysqld和mysqld_safe进程.errorlog和复制状态 3)主机性 ...