CNode

node 进行高并发接口透传,会出现延时增加问题

问答
Llvgithub发布于8 年前最后回复8 年前13 回复5983 浏览0 收藏

具体问题见测试案例 延时会随着压测并发量增大而增大

测试命令

ab -n 1000 -c 200 -r http://localhost:8080/proxy-api webbench -t 10 -c 500 http://localhost:8080/proxy-api

截取部分响应耗时:

get http://ip:9190/user/getUserInfo 2019 ms cost time: 2020 get http://ip:9190/user/getUserInfo 2062 ms cost time: 2062 get http://ip:9190/user/getUserInfo 2064 ms cost time: 2065 get http://ip:9190/user/getUserInfo 2063 ms cost time: 2063 get http://ip:9190/user/getUserInfo 2062 ms cost time: 2063 get http://ip:9190/user/getUserInfo 2063 ms cost time: 2063 get http://ip:9190/user/getUserInfo 2061 ms cost time: 2062 get http://ip:9190/user/getUserInfo 2063 ms cost time: 2064 get http://ip:9190/user/getUserInfo 2063 ms ... ... get http://ip:9190/user/getUserInfo 1362 ms cost time: 1362 get http://ip:9190/user/getUserInfo 1361 ms cost time: 1362 get http://ip:9190/user/getUserInfo 1362 ms cost time: 1362 get http://ip:9190/user/getUserInfo 1362 ms cost time: 1362 get http://ip:9190/user/getUserInfo 1362 ms cost time: 1362 get http://ip:9190/user/getUserInfo 1363 ms cost time: 1363 get http://ip:9190/user/getUserInfo 1362 ms cost time: 1362 ... ... get http://ip:9190/user/getUserInfo 1006 ms cost time: 1006 get http://ip:9190/user/getUserInfo 627 ms cost time: 628 get http://ip:9190/user/getUserInfo 629 ms cost time: 629 get http://ip:9190/user/getUserInfo 628 ms cost time: 629 get http://ip:9190/user/getUserInfo 1403 ms cost time: 1403 get http://ip:9190/user/getUserInfo 1402 ms

查看回复

回复 (13)

A
atian25#1·8 年前

猜什么猜.. 直接接入 alinode 后看热点代码不就知道了...

L
lvgithub#2·8 年前
引用 atian25猜什么猜.. 直接接入 alinode 后看热点代码不就知道了...

@atian25 ...神回复
专业版 购买量 : 1个月 X 1台 配置费用: ¥700.00

L
Lans#4·8 年前

d

L
Lans#5·8 年前

g

M
myy#6·8 年前

个人认为,如果是仅仅是做 http 透传,不需要做太多的解析(比如只解析 http header),这种情况,应该在 Socket 层面来做效率更高,而不是 http 层面。

【client】 ---->http请求---> 【nodejs】 ----> 重新发起http请求 ----> 【web server】

【client】 ---->http请求---> 【nodejs接收socket数据,只解析header】 ----> 转发 socket 的数据包 ----> 【web server】

L
lvgithub#8·8 年前

@狼叔

A
atian25#9·8 年前

免费的好不好...

A
atian25#10·8 年前
L
lvgithub#11·8 年前
引用 atian25http://node.console.aliyun.com

@atian25 已开通,试试大神的作品

J
JacksonTian#12·8 年前

收费版本 alinode.aliyun.com 后续会下线。请使用 https://node.console.aliyun.com ,功能完整,且免费。

参与回复
登录后即可参与回复。登录