首页 > 代码库 > fork failed.: Cannot allocate memory

fork failed.: Cannot allocate memory

 

在做压力测试时候:

[root@666 ok]# webbench -c 5000 -t30 http://10.100.0.61/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://10.100.0.61/
5000 clients, running 30 sec.

Speed=176440 pages/min, 4025737 bytes/sec.
Requests: 88219 susceed, 1 failed.
[root@666 ok]# webbench -c 50000 -t30 http://10.100.0.61/
Webbench - Simple Web Benchmark 1.5
Copyright (c) Radim Kolar 1997-2004, GPL Open Source Software.

Benchmarking: GET http://10.100.0.61/
50000 clients, running 30 sec.
problems forking worker no. 6594
fork failed.: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
bash: fork: Cannot allocate memory
....
bash: cannot make pipe for command substitution: Too many open files

 查询pid_max值:

[root@666 ok]# sysctl kernel.pid_max
kernel.pid_max = 32768

 修改pid_max的值:

[root@666 ok]# sysctl -w kernel.pid_max=60000
kernel.pid_max = 60000
[root@666 ok]# sysctl kernel.pid_max
kernel.pid_max = 60000

 

[root@666 ok]# echo ‘kernel.pid_max=9999‘ >>/etc/sysctl.conf 
[root@666 ok]# sysctl -p
kernel.pid_max = 9999

 

fork failed.: Cannot allocate memory