I recently set up an lnmp on my desktop. I want to press the lnmp to see how it works.
Nginx is only a static web server with high concurrency. Therefore, the performance bottleneck of lnmp lies in the processing capacity of php, that is, php-fpm.
Hardware
Cpu amd Phenom (tm) II X4 945
Memory 4 GB x 4
Hard drive west green disk 7200 rpm
Nic realtek 8169 Gigabit adaptive
Software Version
Nginx 1.4.0
Mysql 5.5.31
Php 5.4.14
The re-compiled rpm package has
Nginx
Mysql
Php
Php-pecl-zendopcache
Libevent
Lnmp optimization methods mainly include:
12345678 Kernel Parameter file handle count php cache nginx compilation nginx pagespeednginx cache nginx compression nginx CPU binding
Use autoscaling to simulate 300 to 1000 concurrency. Each concurrency lasts for 2 minutes, and then the concurrency increases by 100. Each connection has five requests.
Command
Autoscaling -- single_host -- host1 192.168.1.101 -- port1 80 -- uri1/phpinfo. php -- low_rate 300 -- high_rate 1000 -- rate_step 100 -- num_call 5 -- const_test_time 120 -- timeout 2 -- file result. tsv
Result
Connection count request speed req/s connection speed conn/s total number of connections limit
Result Analysis,
When concurrency started at 300, php's processing capability gradually increased, reaching its highest peak of 390.8req/s at 800, and then gradually declined. It can be seen that php's overall processing request capability was around 380 per second, theoretically, the total traffic is about 380 million (32832000x60x60x24 = ).
Based on the 80% principle, 20% of requests are completed in 20% of the time period, 4.8 of the time is 6.5 million hours, and the number of requests that can be tolerated is 380 (4.8x60x60x6566400 = ), the actual total traffic is 8.2 million (6566400/0. 8 = 8208000 ).
According to Daniel Zhang's blog, he can achieve 700req/s (theoretically equivalent to 6 million daily visits), but he compiles the whole process, and here I use rpm for the whole process, only some core software packages are re-compiled by srpm, and the hardware is just a common desktop.
In short, there is still a lot of optimization space to continue!