Cause: When the pressure test, it appears the problem
Benchmarking www.local_test.com (be patient)
socket: Too many open files (24)
$ ab -n 6000 -c 5000 http://www.local_test.com/goods This is ApacheBench, Version 2.3 <$Revision: 1826891 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking www.local_test.com (be patient) socket: Too many open files (24)
The server can detect the number of open files
Linux ulimit command shell program for resource control. ulimit shell built-in command is used to control the execution of the program shell resources. Syntax the ulimit [ -aHS] [- C <Core Maximum file>] [- d <section data block size>] [- f <Size>] [- m <memory size>] [- n <file number>] [ -p <buffer size>] [- s <stack size>] [- t <CPU time>] [- u <program number>] [- v <virtual memory size> ] parameters: - a display current resource limitation set up. -c <core Maximum file> set the maximum core file, in units of blocks. -d <section data block size> maximum section area of the program data in units of KB. -f <file size> Maximum file can be created shell, in units of blocks. - H set a hard limit of resources, which is under the limit set by the administrator. -m <memory size> Specifies the upper limit of the memory, in units of KB. -n <number of files> Specifies the same time open up the number of files. -p <buffer size> Specifies the size of the pipe's buffer, 512 units of bytes. -s <stack size> The upper limit of the stack specified in units of KB. - S set elastic resource constraints. -t <CPU time> CPU time limit specified in seconds. -u <program number> the number of programs a user can open up. -v <virtual memory size> specifies the maximum virtual memory can be used, in units of KB.
View Results:
$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 1418 virtual memory (kbytes, -v) unlimited
Modification 10000
$ ulimit -n 10000 测试 $ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 10000 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 1418 virtual memory (kbytes, -v) unlimited
Again stress tests
Error Problem:
apr_socket_recv: Connection reset by peer (54)
MacOSX is due to the use of own ab limit the number of concurrent cause of default.
Solution: Download the latest apache and recompile, backup and replace the original ab ab newly compiled to the original path.
First download the file: httpd-2.4.25.tar.bz2, at compile time that there is no apr and apr-util, the two first installation;
Download the official website: HTTP: //apr.apache.org/downloa ... and http://apache.fayea.com/httpd/
//解压
tar -zxvf apr-1.5.2.tar.gz //进入解压后目录
./configure --prefix=/usr/local/apr
make & make install
//同理 tar -zxvf apr-util-1.5.4.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make & make install //同理
tar -zxvf httpd-2.4.25.tar.bz2
./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util make & make install
Error Problem:
apr_socket_connect(): Operation already in progress (37)
to be solved