`
youxinrencwx
  • 浏览: 67237 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

慢连接&LazyParser

阅读更多

慢连接&LazyParser

Author:放翁(文初)

Mail:fangweng@taobao.com

Tblog:weibo.com/fangweng

这里要从实际的测试中给Web应用开发者一个比较直观的关于慢连接优化的建议。

测试目标:

1. 证明慢连接对于Java的应用容器的影响。

2. 不同前端反向代理服务器对于慢连接的处理差异。

3. 如何利用LazyParser的方式来优化慢连接请求(特别是大数据量的一些异常请求的处理)

测试部署环境描述:

Apache服务器(2.2.19版本)配置基本没变,增加了http proxy模块作为反向代理。

Nginx服务器(1.0.4版本)配置基本没变,增加了反向代理。

Jetty服务器(7.1.6版本)配置基本没变。JettyLazy解析缓存为8k

部署如下,外部请求可以通过三个入口访问应用真实逻辑。(apache,nginx,jetty

测试代码:

服务端:

简单描述一下逻辑:

1. 根据http消息头判断采用lazy还是普通方式解析。

2. 输出start test表示开始。

3. 获取key1,key2的内容,并记录消耗时间输出phase 1 use:xxx作为获取这两个参数的消耗。

4. 获取key4的内容,并记录消耗时间输出phase 2 use:xxx作为获取这个参数的消耗。

5. 获取key3的内容,并记录整个请求消耗的时间,输出end total use:xxx,作为整个处理消耗的时间。

客户端代码:

1. 配置不同入口访问应用。

2. 是否设置使用lazyhttp header来引导服务端处理。

3. 构建参数集合,参数顺序为(key1,key2,key3,key4)。其中key3作为一个大数据字段可变,用于多个场景测试。

测试结果及分析:

1. 设置key3大小为1000char,对比多个场景:

a. 不用lazy解析模式

(1) 通过nginx访问:

Nginx日志(第一位是消耗时间单位秒):0.002 115.193.162.12 - - [20/Jun/2011:10:50:44 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 19 "-" "Jakarta Commons-HttpClient/3.0.1" "-"

Jetty日志:

start test: not use lazy

phase 1 use :0

phase 2 use :1

end total use:1

(2) 通过 apache访问:

Apache日志:(第二位消耗时间单位微秒):0 3513 115.193.162.12 - - [20/Jun/2011:10:53:24 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 9

Jetty日志:

start test: not use lazy

phase 1 use :0

phase 2 use :0

end total use:0

(3) 直接访问jetty

Jetty日志:

start test: not use lazy

phase 1 use :1

phase 2 use :0

end total use:1

b. lazy解析模式

同样是上面三种模式,web容器的日志就不写出来了结果一样,下面主要是贴一下应用服务器的情况:

----------------------------------------------------jetty

start test : uselazy

Jun 20, 2011 10:57:24 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1019

phase 1 use :1

Jun 20, 2011 10:57:24 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :0

end total use:1

-----------------------------------------------------------nginx

start test : uselazy

Jun 20, 2011 10:58:37 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1019

phase 1 use :0

Jun 20, 2011 10:58:37 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :0

end total use:0

-----------------------------------------------------------apache

start test : uselazy

Jun 20, 2011 10:58:45 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1019

phase 1 use :0

Jun 20, 2011 10:58:45 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :1

end total use:1

上面的输出增加了一些,其实lazyparser在逐块解析字节流的时候每次装载数据的输出,lazyparser的缓冲区当前设置最大为8k,根据上面的情况可以看到不论哪一种方式,数据一次性都被装载,不存在后端处理的差异。

2. 设置key3大小为100000char,对比多个场景:

a. 不用lazy解析模式

(1) 通过nginx访问:

Nginx日志(第一位是消耗时间单位秒):1.528 115.193.162.12 - - [20/Jun/2011:11:05:34 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 19 "-" "Jakarta Commons-HttpClient/3.0.1" "-"(消耗时间大幅上升)

Jetty日志:

start test: not use lazy

phase 1 use :5

phase 2 use :0

end total use:6

(2) 通过 apache访问:

Apache日志:(第二位消耗时间单位微秒):1 1502243 115.193.162.12 - - [20/Jun/2011:11:07:10 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 9

Jetty日志:

start test: not use lazy

phase 1 use :609

phase 2 use :0

end total use:609

(3) 直接访问jetty

Jetty日志:

start test: not use lazy

phase 1 use :1463

phase 2 use :0

end total use:1463

从上面几个数据来看,首先不论哪个入口进去,总的时间处理都在1.5秒左右(我的网络状况还是比较烂),但nginx的数据堆积效果对jetty起到了明显的保护作用,使得jetty整个容器线程池生命周期较短,可以处理更多的请求,apache数据堆积不是全量堆积,因此对于jetty来说还需要自身的一些堆积处理(这点在后面的lazy模式下将会更加直观的看到过程)

b. lazy解析模式

(1) 通过nginx访问:

Nginx日志(第一位是消耗时间单位秒):1.513 115.193.162.12 - - [20/Jun/2011:11:13:22 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 19 "-" "Jakarta Commons-HttpClient/3.0.1" "-"(消耗时间大幅上升)

Jetty日志:

start test : uselazy

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 5911

phase 1 use :1

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 8192

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 3996

Jun 20, 2011 11:13:22 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :7

end total use:8

从上面的结果可以看到,nginx的数据堆积效果很好,jetty都是塞满lazyparser的缓存大小来处理的,所以Java IO次数少,整体消耗时间短。

(2) 通过 apache访问:

Apache日志:(第二位消耗时间单位微秒):1 1521576 115.193.162.12 - - [20/Jun/2011:11:16:37 -0400] "POST /cometpipe/slowtest?key1=1 HTTP/1.1" 200 9

Jetty日志:

start test : uselazy

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 5787

phase 1 use :1

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 2405

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:13,count: 8096

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:280,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:6,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:13,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:10,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:265,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:7,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:13,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:7,count: 8192

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 448

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:6,count: 6419

Jun 20, 2011 11:16:38 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :627

end total use:628

可以看到第一阶段处理由于是lazy的模式,没有像普通请求处理那样消耗都在第一阶段,而是把消耗时间落在了真正要拿那些数据处理的第二阶段,同时可以看到apache有满cache和非满cache的数据后传,同时由于是变积累边传递,每次后传所消耗的时间都要远大于nginx,因此对于jetty的保护较弱。(所以如果你不是用mod_jk去直接反向代理到后段的应用容器(jboss,tomcat,jetty)都会使得应用服务器load比较高,线程生命周期长了,线程切换频繁)

(3) 直接访问jetty

Jetty日志:

start test : uselazy

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1217

phase 1 use :1

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:294,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:309,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:46 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:287,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:4,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:3,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:273,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:16,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:2,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:246,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:23,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:1,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 1440

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: 882

Jun 20, 2011 11:22:47 AM com.taobao.top.xbox.framework.http.LazyParser readBytes

SEVERE: timconsume:0,count: -1

phase 2 use :1532

end total use:1533

上面的输出大家会看到虽然我给了8klazy解析缓冲区,但是每次过来的数据都是1440,这个数字的含义大家可以去查一下TCP传输的数据包大小定义。可以看到,其实如果网络速度不佳,我们就会一个一个的得到数据包,Java IO次数及每次消耗的时间都会较长,同时这也是直接把Java应用服务器对外接收请求在高并发,慢请求的状况下,系统压力会远高于前端假设反向代理http服务器。

总结:

测试很简单,但说明了几个问题:

1. 互联网上的请求和内网测试环境完全是两码事情(如果你还打算支持mobile)。

2. Nginxapache作为反向代理,对于后端的web容器的处理是有一定帮助的,特别是nginx,作为数据堆积和海量连接的并发支持能够很好的充分利用后端应用服务器的线程资源。

3. 不论哪一种模式,总体请求时间都是差不多的,因此RT在后端资源不是瓶颈的时候,不会由于你架设了反向代理而得到优化,反而会有所增长(毕竟多了一层中转)

4. Lazy处理可以极大提高串行化分阶段处理的性能(特别是在没有数据堆积的情况下或者是apache这样的半数据堆积的情况下,在nginx模式下失效)。比如一个很大的请求,如果在第一阶段就被判断系统参数校验错误,那么后续的请求数据将直接拒绝(或者类似于有图片大小限制或者是图片个数限制的判断)。

5. 应用服务器(jetty,tomcat,jboss等等)不论使用nio或者bio模式,在慢连接的情况下都会有不小的性能消耗。

对于开放平台来说,每天处理几十亿的api call,和普通的web应用不同,每一次请求的时间就贯穿于容器对于数据流的载入,处理,一点优化都可以极大地提高整体的处理能力和资源使用效率,当前开放平台采用nginx+jetty,虽然可以保护到jetty对于高并发的慢连接支持,但是整体的响应时间及资源消耗状况都没有被充分利用到(虽然Lazy解析已经被装配上,apache+jboss时代比较有效果),因此后续考虑要做三种改进:1.nginx支持部分数据堆积模式。2.优化jettybio模式的nio3.替换掉jettynio模块(netty)。最终不是让前端采用部分堆积,就是直接暴露应用容器到外部,再加上lazyparser,来完成对于慢连接的优化。

分享到:
评论

相关推荐

    weloveinterns:中科院软件所智能软件中心实习生社区

    吴伟(lazyparser)是目前仓库的主要维护者。具体介绍可以从 看到。PLCT实验室 全称是程序语言与编译技术实验室。PLCT致力于成为编译技术领域的开源领导者,推进开源工具链及运行时系统等软件基础设施的技术革新,...

    node-v5.11.1-sunos-x64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    基于BP用matlab实现车牌识别.zip

    基于MATLAB的系统

    Java毕业设计-基于SSM框架的学生宿舍管理系统(源码+演示视频+说明).rar

    Java毕业设计-基于SSM框架的学生宿舍管理系统(源码+演示视频+说明).rar 【项目技术】 开发语言:Java 框架:ssm+vue 架构:B/S 数据库:mysql 【演示视频-编号:445】 https://pan.quark.cn/s/b3a97032fae7

    HTML+CSS+JS小项目集合.zip

    html Tab切换 检测浏览器 事件处理 拖拽 Cookie JavaScript模板 canvas canvas画图 canvas路径 WebGL示例 HTML5+CSS3 照片墙 幽灵按钮 综合实例 100du享乐网 高仿小米首页

    node-v6.17.1-linux-ppc64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    gRPC C++快速序列号跨平台库

    gRPC是轻量型且高性能的。 其处理速度可以比JSON序列化快 8 倍,消息小60%到 80%。 在Microsoft Windows Communication Foundation (WCF) 中,gRPC的性能超过经过高度优化的NetTCP绑定的速度和效率。 与偏向于Microsoft堆栈的NetTCP不同,gRPC是跨平台的。

    基于SSM+Vue的电子书籍敏感字识别系统毕业设计(源码+录像+说明).rar

    基于SSM+Vue的电子书籍敏感字识别系统毕业设计(源码+录像+说明).rar 【项目技术】 开发语言:Java 框架:ssm+vue 架构:B/S 数据库:mysql 【演示视频-编号:447】 https://pan.quark.cn/s/b3a97032fae7 【实现功能】 管理员管理字典管理、公告信息管理、敏感词管理、书籍管理、用户管理、章节管理、作者管理、管理员管理等功能。【项目技术】 开发语言:Java 框架:ssm+vue 架构:B/S 数据库:mysql 【演示视频-编号:447】 https://pan.quark.cn/s/b3a97032fae7 【实现功能】 管理员管理字典管理、公告信息管理、敏感词管理、书籍管理、用户管理、章节管理、作者管理、管理员管理等功能。

    node-v6.10.3-linux-ppc64le.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    基于深度学习的USPS手写体识别模型.zip

    基于深度学习的USPS手写体识别模型.zip

    Java毕业设计-基于SSM框架的小码创客教育教学资源库(源码+演示视频+说明).rar

    Java毕业设计-基于SSM框架的小码创客教育教学资源库(源码+演示视频+说明).rar 【项目技术】 开发语言:Java 框架:ssm+vue 架构:B/S 数据库:mysql 【演示视频-编号:468】 https://pan.quark.cn/s/b3a97032fae7 【实现功能】 本基于SSM的小码创客教育教学资源库的设计与实现有管理员,校长,教师,学员四个角色。管理员可以管理校长,教师,学员等基本信息,校长角色除了校长管理之外,其他管理员可以操作的校长角色都可以操作。教师可以发布论坛,课件,视频,作业,学员可以查看和下载所有发布的信息,还可以上传作业。

    大二上python课设,一个基于max-min算法以及深度强化学习的井字棋游戏.zip

    大二上python课设,一个基于max-min算法以及深度强化学习(参考谷歌论文mastering the game of go without human knowledge)的井字棋游戏.zip

    node-v6.14.4-linux-arm64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    node-v4.9.1-sunos-x64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    node-v4.7.2-sunos-x64.tar.xz

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    C# QuadTree For CAD

    cad环境下的四叉树代码,提高图形查速度

    node-v0.12.5-x86.msi

    Node.js,简称Node,是一个开源且跨平台的JavaScript运行时环境,它允许在浏览器外运行JavaScript代码。Node.js于2009年由Ryan Dahl创立,旨在创建高性能的Web服务器和网络应用程序。它基于Google Chrome的V8 JavaScript引擎,可以在Windows、Linux、Unix、Mac OS X等操作系统上运行。 Node.js的特点之一是事件驱动和非阻塞I/O模型,这使得它非常适合处理大量并发连接,从而在构建实时应用程序如在线游戏、聊天应用以及实时通讯服务时表现卓越。此外,Node.js使用了模块化的架构,通过npm(Node package manager,Node包管理器),社区成员可以共享和复用代码,极大地促进了Node.js生态系统的发展和扩张。 Node.js不仅用于服务器端开发。随着技术的发展,它也被用于构建工具链、开发桌面应用程序、物联网设备等。Node.js能够处理文件系统、操作数据库、处理网络请求等,因此,开发者可以用JavaScript编写全栈应用程序,这一点大大提高了开发效率和便捷性。 在实践中,许多大型企业和组织已经采用Node.js作为其Web应用程序的开发平台,如Netflix、PayPal和Walmart等。它们利用Node.js提高了应用性能,简化了开发流程,并且能更快地响应市场需求。

    12 催货通知单-EPES19-SC-CG-027-2023.xlsx

    12 催货通知单-EPES19-SC-CG-027-2023.xlsx

    基于SSM+JSP的家具销售库存管理信息系统毕业设计(源码+录像+说明).rar

    基于SSM+JSP的家具销售库存管理信息系统毕业设计(源码+录像+说明).rar 【项目技术】 开发语言:Java 框架:ssm+jsp 架构:B/S 数据库:mysql 【演示视频-编号:493】 https://pan.quark.cn/s/b3a97032fae7

Global site tag (gtag.js) - Google Analytics