压力测试软件:http_load【机子上无AB(Apache Benchmark)Siege无法产生过多的模拟进程(1G内存只能开60个进程并发)只好选http_load

客户端是一台512M内存突发1024M内存的VPS,上行一般只有10~30Mbps【也就是1~3MB/s,带宽单位的问题不多解释】下行有100~300Mbps

服务端[被测试端]进行了一定的优化。修改了内核参数文件以及nginx的进程数

nginx.conf优化部分:

worker_processes 2;

#打开两个nginx进程

worker_cpu_affinity 0101 1010;

#将两个nginx进程绑定分别绑定到四个CPU核心上

worker_rlimit_nofile 65536;

#每个worker限制打开65536个文件,这里如何设置应该使用ulimit -n命令查看。当然这个系统限制可以修改

 

一个摘录来的完整的sysctl.conf

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmall = 268435456

kernel.shmmax = 4294967295

net.ipv4.tcp_max_tw_buckets = 6000

net.ipv4.tcp_sack = 1

net.ipv4.tcp_window_scaling = 1

net.ipv4.tcp_rmem = 4096        87380    4194304

net.ipv4.tcp_wmem = 4096        16384    4194304

net.core.wmem_default = 8388608

net.core.rmem_default = 8388608

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

net.core.netdev_max_backlog = 262144

net.core.somaxconn = 262144

net.ipv4.tcp_max_orphans = 3276800

net.ipv4.tcp_max_syn_backlog = 262144

net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_synack_retries = 1

net.ipv4.tcp_syn_retries = 1

net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_mem = 94500000 915000000 927000000

net.ipv4.tcp_fin_timeout = 1

net.ipv4.tcp_keepalive_time = 30

还有一些零碎的优化。。。可以百度看看。。。嗯

两个测试目标:

tucao.org和www.gengu.org[言冬博客]

测试参数:150秒,1000个并发

结果:

言冬博客

 

46023 fetches, 1000 max parallel, 1.14329e+08 bytes, in 150.001 seconds

在150.001秒钟共链接46023次。最高1000并发。总共传输~109.033mb的数据

2484.18 mean bytes/connection

每个连接传输2484.18bytes

306.818 fetches/sec, 762189 bytes/sec

每秒实际平均发送306.818个请求,平均每秒收到762189bytes[0.72mb/s]

msecs/connect: 84.3222 mean, 9066.12 max, 46.552 min

每个连接平均响应时间:84.3222msecs,最大是9066.12,最小是46.552

msecs/first-response: 3127.1 mean, 8213.34 max, 117.576 min

218 bad byte counts

出现了218次请求内容和上次不一样的情况【根据下文可判断218次都是提示500错误】

HTTP response codes:

HTTP响应统计:

  code 200 — 45805

200正常 — 45805次

  code 500 — 218

500错误 — 218次

 

自己的

 

33529 fetches, 1000 max parallel, 1.72277e+09 bytes, in 150 seconds

在150秒钟共链接33529次。最高1000并发。总共传输~1642.961mb的数据

51381.5 mean bytes/connection

每个连接传输51381.5bytes

223.526 fetches/sec, 1.14851e+07 bytes/sec

每秒实际平均发送223.526个请求,平均每秒收到10.95mb/s

msecs/connect: 561.087 mean, 9283.16 max, 42.067 min

每个连接平均响应时间:561.087msecs,最大是9283.16,最小是42.067

msecs/first-response: 897.262 mean, 12254.5 max, 43.474 min

29 bad byte counts

出现了29次请求内容和上次不一样的情况【根据下文判断29次均属正常响应】

HTTP response codes:

HTTP响应代码统计:

  code 200 — 33500

200正常 — 33500次

注:出现了16次连接超时

 

言冬博客程序好像是centos自带的apache