: This article mainly introduces the concurrency performance test apacheng.pdf. if you are interested in the PHP Tutorial, refer to it. Concurrent performance test
1 Purpose
Analyze the advantages and disadvantages of the concurrency model based on the test results of Apache and Nginx concurrency performance.
Performance Evaluation items include: RPS (number of requests processed per second), CPU usage, memory usage, and maximum concurrency.
Select a suitable concurrency model framework based on the advantages and disadvantages of the Apache and Nginx concurrency models.
2 Test Environment
1. hardware environment
Server: Interl server Borad
8-core CPU, 2 GB memory, GB hard disk,
Client: same as the server environment
2. operating system
Operating system: Red Hat EnterPrise kernel Linux 2.6.18
Client: Red Hat EnterPrise kernel Linux 2.6.9
3. Network topology
The server and the client are connected to a vSwitch through a 10-Gigabit network cable
Server IP address: 192.168.192.201
Client IP address: 192.168.192.200
3 test method
3.1 Test Tool
Apache 2.2.10 built-in tool plugin
Webbench 1.5
3.2 Test Procedure
1. check and install the device
Check whether all devices in the system are in good condition and connect the devices to the host.
2. network connection check
The server and the client are connected to the same vSwitch using a 10-Gigabit network cable.
3. prepare the operating system
Start Red Hat Enterprise
Install the mouse driver and configure the network
4. download, install, and configure
See Appendix
5. apache testing
Run apache
Cd/usr/local/apache/bin
./Apachectl-k start
The apache service is successfully started.
Access: http: // 192.168.192.201/index.html in windows
"It works!" is displayed !" Test page
Run the apche testing program
Cd/usr/local/apache/bin
./AB-c Clients-n Requests http: // 192.168.192.201/index.html
Run the webbench test program
Cd/usr/local/bin
Webbench-c Clients-t time http: // 192.168.192.200/index.html
(Clients indicates the number of users, and Requests indicates the number of concurrent users)
6. Nginx testing
Run nginx
./Nginx
Nginx service started successfully
Access: http: // 192.168.192.201/index.html in windows
"Welcome to nginx!" is displayed !" Page
To compare the testing result, copy the index.html tab of the apachetest page to overwrite the nginx test page.
Run the apche testing program
Cd/usr/local/apache/bin
./AB-c Clients-n Requests http: // 192.168.192.201/index.html
Run the webbech test program
Cd/usr/local/bin
Webbench-c Clients-t time http: // 192.168.192.200/index.html
7. record test results
Record token test results: Time taken for tests (test Time, unit: seconds), Requests per second (number of Requests processed per second)
Record the webbench test results: Speed (number of requests processed per minute. in order to be consistent with Apache runtime, * 30 is converted to the number of requests processed per second). The running time is specified according to the operation command-t, 30 seconds by default
Command to view CPU usage: top
Memory usage command: free
4 Test Plan
Nginx single-thread test
Nginx multithreading test
Test Apache woker mode
Apache prefork mode test
5. Data Summary
Test configuration: for Apache configuration, see 7.4. for Nginx configuration, see 7.5.
For raw data, see raw data xls.
The data is summarized as follows:
Server client RPS
Idle Free (used)
Nginx single process 79 102526 K 82 185196 K 20757
Nginx multi-process 81 395444 K 85 177405 K 20861
Apahce prefork 38 154380 K 75 178215 K 30181
Apache worker 41 81506 K 81 183166 K 24669
6 Test conclusion
7 Appendix
7.1 install Webbench
Procedure
Download installation package wget http://blog.s135.com/soft/linux/webbench/webbench-1.5.tar.gz
Decompress tar zxvf webbench-1.5.tar.gz
Compile cd webbench-1.5
Make
Install make install
7.2 install Apache
Procedure
Download installation package in http://www.apache.org download software package httpd-2.2.10.tar.gz latest stable
Unzip tar xvzf httpd-2.2.10.tar.gz
Compilation options./configure -- prefix =/usr/local/apache installation path
-- Enable-module = shared memory between processes
-- Enable-module = rewrite
-- Enable-threads thread support (valid in Worker mode)
-- Enable-shared = max
-- With-mpm = worker Worker mode selection
-- With-mpm = prefork Prefork mode selection
-- With-mpm = event I/O reuse support
Make compilation
Install make install
7.3 Nginx installation
Procedure
Download the installation package at http://sysoev.ru/nginx/download.htmland download the software package nginx-0.7.24.tar.gz for the latest stable version.
Unzip tar xvzf ginx-0.7.24.tar.gz
Compile./configure -- prefix =/usr/local/installation path
Make compilation
Install make install
7.4 Apache configuration
Apache configuration command:
Cd/usr/local/apache/conf
Vi http. conf
Parameter configuration in prefork mode:
Configure Apache
Prefork mode -- with-mpm = prefork
Number of processes created at system startup: StartServers 128 // comparable to Nginx
Active sub-processes: ServerLimit 50000
The number of processed connections in the sub-process life cycle is not limited to MaxRequestsPerChild 0 // 0
Maximum number of sub-processes MaxClients 50000
Listening port Listen 80
Timeout Timeout 300
KeepAlive KeepAlive On
Sendfile EnableSendfile on
Worker mode configuration:
Configuration item implementation
Worker mode -- with-mpm = worker
StartServers 32
Active sub-processes: ServerLimit 7812
Maximum number of threads MaxClients 500000
Thread count of sub-process ThreadsPerChild 64 // equal to the maximum value allowed by Apache
Listening port Listen 80
Timeout Timeout 300
KeepAlive KeepAlive On
Sendfile EnableSendfile on
7.5 Nginx configuration
Nginx configuration command:
Cd/usr/local/nginx/conf
Vi nginx. conf
Test the Nginx configuration command:
./Nginx-t
Main configurations of a single worker process:
Configure Nginx
Worker_processes 1;
Number of connections processed by the process worker_connections 102400;
Listening port server {
Listen 80;
}
Sendfile sendfile on;
I/O reuse method use epoll;
Multi-worker process configuration:
Configure Nginx
Worker_processes 16;
Number of connections processed by the process worker_connections 102400;
Listening port server {
Listen 80;
}
Sendfile sendfile on;
I/O reuse method use epoll;
The preceding section describes the concurrency performance test of apache nginx, including some content. I hope you will be helpful to anyone interested in the PHP Tutorial.