|
用 nginx 做负载均衡出现问题:
nginx 配置
worker_processes 8;
events {
worker_connections 10240;
}
upstream ad.demo.cn {
server 192.168.1.100:81 weight=1;
server 192.168.1.100:82 weight=1;
server 192.168.1.100:83 weight=1;
server 192.168.1.100:84 weight=1;
server 192.168.1.100:85 weight=1;
server 192.168.1.100:86 weight=1;
server 192.168.1.100:88 weight=1;
server 192.168.1.100:89 weight=1;
}
nginx:0.6.32
硬件配置:
Intel(R) Xeon(R) CPU E5410 @ 2.33GHz x2
8G 内存
146G SAS 磁盘 RAID1
千兆网络
OS:
CentOS 5.2 x64
192.168.1.100:81 - 192.168.1.100:89 是跑自己做的程序(用libevent做的),跑在linux下面,和nginx放在同一台服务器上,因为是单进程程序,所以用nginx做负载均衡。
用另一台同配置的服务器运行webbench进行200客户并发测试:
测试自己做的程序,cpu占用率在50%左右,每分钟响应80万的链接
[root@urladserver1 src]# ./webbench -c200 http://192.168.1.100:81/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.
Benchmarking: GET http://192.168.1.100:81/
200 clients, running 30 sec.
Speed=839910 pages/min, 5921337 bytes/sec.
Requests: 419955 susceed, 0 failed.
但是测试nginx时不正常,服务器cpu占用率是1%左右,每分钟响应1000左右的链接
若测试nginx时,客户并发是1个时,也是正常的,每分钟能响应80万的链接
请问大大们,问题出在哪里? |
|