windows7及以上系统千万别用nginx做代理,性能不升反降

上周末在家闲的没事干,突然想对nginx做个性能测试,看看到底比tomcat快多少..

然而...结果让我出乎意料的大吃一斤....竟然快了-200%....

注意是前面有个负号..

当时的测试是100个线程*100次请求

大概数据是这样的,平均响应tomcat是28ms左右,nginx是80ms左右...

然后百思不得其解...故找了个QQ群交流了一下...

得到的答案是,由于windows不支持nginx的epoll,导致nginx少了一大致命武器..

#工作模式及连接数上限
events {
    #use   epoll;             #epoll是多路复用IO(I/O Multiplexing)中的一种方式,但是仅用于linux2.6以上内核,可以大大提高nginx的性能
    worker_connections  1024;#单个后台worker process进程的最大并发链接数
    # multi_accept on;
}

然后在windows 7下nginx无法缓存,当时群里有人说windows下可以缓存也有人说不可以,说可以缓存的说用的最新版1.11.3非稳定版,然后我也逐个测试了一次,依旧不能缓存.

后来上官网看了下,借鉴一句话

  1. Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected. Due to this and some other known issues version of nginx for Windows is considered to be a beta version.  
大致意思应该是这样的,英语不好,大神勿喷..

nginx的windows版本使用的是windows 32位API,目前只支持切换连接的功能,不要期望它有高性能的展现

另附上使用须知,

大致意思就是说缓存等其它模块不支持在windows vista 及之后的版本工作.

所以说windows server 2003应该没多大问题(群里说可以缓存的用的就是server2003),其余的根据vista发布的时间自己算吧.

  1. Known issues  
  2.   
  3. Although several workers can be started, only one of them actually does any work.  
  4. A worker can handle no more than 1024 simultaneous connections.  
  5. The cache and other modules which require shared memory support do not work on Windows Vista and later versions due to address space layout randomization being enabled in these Windows versions.  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值