Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加分叉并行访问与普通阻塞访问对比测试,增加了数据库表,使用前请执行相应sql语句 #25

Merged
merged 2 commits into from
Feb 26, 2019

Conversation

lingxiezfy
Copy link
Contributor

增加分叉并行访问与普通阻塞访问对比测试,增加了数据库表,使用前请执行相应sql语句,
为了能更清晰的看到结果,可以增加数据库中数据量或者增加代码延时。
此次测试建立在web层,均为非并发访问,使用单独的service:BlockService来模拟原始的阻塞访问。这样做的目的是精准的对比分叉并行处理的性能。

import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class SessionFactory {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个类在请求高并发的时候有问题,删掉吧,用spring xml里的连接池提供数据库连接

* @Author: fengyu.zhang
* @Date: 2019/2/24 13:13
*/
public class BlockServlet extends HttpServlet {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockServlet不使用Flower,参考SyncServlet的写法,也就是传统web应用的写法,在service里面顺序调用三个dao,达到串行阻塞的目的

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

参考/flower.sample/src/main/java/com/ly/train/flower/sample/web/performance里的测试工具,对blockServlet和forkServlet做个对比测试,主要看响应时间的对比。工具使用有问题 @lasting-yang

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修改为sync方式调用

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.高延时测试

default

2.并发测试

default
default

以上数据来自电脑本地回环测试,数据值受到机器性能影响,,但是也能较明显的看出差异所在,也能大致推测出性能走向。

通过高延时数据可以看到,当将耗时较高的服务,使用Flower分叉并行处理,能够加快响应。

通过并发数据可以明显的感知到,到并发量到达某一个阀值的时候,Flower的并发处理更为稳定,能够平衡在某个吞吐量附近,根据数据的现象,推算这个值应该处于3倍Flower服务的流程数附近,吞吐量到达了这个值之后,访问出错率会出现轻微的增加,增长速度并不快;而传统的阻塞系统面对突然暴涨的并发数,其性能会急剧下降,访问出错率几乎成指数级增长。
从这一点看,Flower能够很好的适应大量并发的环境,提升系统稳定性,加快系统响应,解决目前的系统现状。

同时,数据也反应出Flower框架也存在其瓶颈,无法保证是否存在下一个阀值,让系统的性能如传统阻塞系统那般急剧下降,从访问出错率的增长来看,尽管Flower大程度的避免阻塞响应,但是当Flower与业务联合的时候,是有可能产生下一个阀值的;或许这并不只是Flower本身的瓶颈,也是现所有高并发系统的瓶颈。

@zhihuili
Copy link
Owner

thanks @lingxiezfy

@zhihuili zhihuili merged commit 7407850 into zhihuili:master Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants