+ -
当前位置:首页 → 问答吧 → nginx压力测试的并发问题

nginx压力测试的并发问题

时间:2010-10-28

来源:互联网

本帖最后由 tevoo2 于 2010-10-28 14:54 编辑

服务器配置:Dell R710, 8G内存, ubuntu 10.10。

压力测试的页面是 index.html ,该文件值包含了"Hello World!"

500的并发: http_load -f 10000 -p 500 urllist.txt
结果:
10000 fetches, 500 max parallel, 220000 bytes, in 0.693075 seconds
22 mean bytes/connection
14428.5 fetches/sec, 317426 bytes/sec
msecs/connect: 0.4445 mean, 4.755 max, 0.143 min
msecs/first-response: 33.1882 mean, 35.305 max, 0.427 min
HTTP response codes:

600的并发:http_load -f 10000 -p 600 urllist.txt
10000 fetches, 600 max parallel, 220000 bytes, in 3.12906 seconds
22 mean bytes/connection
3195.85 fetches/sec, 70308.6 bytes/sec
msecs/connect: 14.6379 mean, 3009.82 max, 0.141 min
msecs/first-response: 45.6007 mean, 3007.76 max, 0.436 min
HTTP response codes:
  code 200 -- 10000

并发数就差100,为什么结果就差这么远?这个瓶颈会出在哪里?


我的nginx的大致配置是:
  1. worker_processes  4;
  2. worker_cpu_affinity 0001 0010 0100 1000;
  3. worker_rlimit_nofile 102400;
  4. events {
  5.     use epoll;
  6.     worker_connections  102400;
  7. }
复制代码
/etc/security/limits.conf的配置:
  1. * soft nofile 102400
  2. * hard nofile 102400
复制代码
/etc/sysctl.conf的配置
  1. net.ipv4.ip_forward = 0
  2. net.ipv4.conf.default.rp_filter = 1
  3. net.ipv4.conf.default.accept_source_route = 0
  4. kernel.sysrq = 0
  5. kernel.core_uses_pid = 1
  6. net.ipv4.tcp_syncookies = 1
  7. kernel.msgmnb = 65536
  8. kernel.msgmax = 65536
  9. kernel.shmmax = 68719476736
  10. kernel.shmall = 4294967296
  11. net.ipv4.tcp_max_tw_buckets = 6000
  12. net.ipv4.tcp_sack = 1
  13. net.ipv4.tcp_window_scaling = 1
  14. net.ipv4.tcp_rmem = 4096        87380   4194304
  15. net.ipv4.tcp_wmem = 4096        16384   4194304
  16. net.core.wmem_default = 8388608
  17. net.core.rmem_default = 8388608
  18. net.core.rmem_max = 16777216
  19. net.core.wmem_max = 16777216
  20. net.core.netdev_max_backlog = 262144
  21. net.core.somaxconn = 262144
  22. net.ipv4.tcp_max_orphans = 3276800
  23. net.ipv4.tcp_max_syn_backlog = 262144
  24. net.ipv4.tcp_timestamps = 0
  25. net.ipv4.tcp_synack_retries = 1
  26. net.ipv4.tcp_syn_retries = 1
  27. net.ipv4.tcp_tw_recycle = 1
  28. net.ipv4.tcp_tw_reuse = 1
  29. net.ipv4.tcp_mem = 94500000 915000000 927000000
  30. net.ipv4.tcp_fin_timeout = 1
  31. net.ipv4.tcp_keepalive_time = 30
  32. net.ipv4.ip_local_port_range = 1024    65000
复制代码

作者: tevoo2   发布时间: 2010-10-28

性能下降如此快,就表示你遇到了"拐头"!

性能压力测试的"拐头"这个词你可以去网上找找.应该有介绍!


捌头的出现.不仅仅是nginx配置的问题!
还涉及到其它的瓶颈!

network
io
memory
cpu

自己测试的时间要长30分钟以上吧!同时做好性能的实时监控!再发现问题!

作者: todayhero   发布时间: 2010-11-02

前后两次测试的时候.硬件性能,最好能自己划个画表.然后先后对比!是那部分出现了性能问题导致的.

作者: todayhero   发布时间: 2010-11-02