I have been messing around with server-related things recently and encountered some problems. I would like to ask everyone for help.
Current website access status: PV: 15W+, IP: 2W+
server configuration:
CPU: 4 * Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz
Memory: 4G
Bandwidth: 6M
Hard drive: 2 * 100G HDD
This server used to use wdcp panel, php5.2 + mysql 5.1. The CPU and load during peak periods have been very stable. Later, after the site was hacked, I took over the processing. After reinstalling the system, it was also built with one click. Environment (package on blog.linuxeye.com), built Lanmp environment, after starting the service, use another server ab test (ab -c 100 -n 500), the CPU is immediately full, and the load is also soaring. The program is WordPress, although it can withstand the current peak period, the CPU is often around 98%, and the access speed is not as fast as before;
By checking the concurrencynetstat -an | grep ESTABLISHED | wc -l
, it is obvious that you have to wait about 3 seconds when accessing at around 600 during the peak period, and the load is also very high.
What I want to know about this is:
Please give me some guidance from experienced seniors, thank you!
See what is occupying the CPU, is it waiting for IO.
If you already have Nginx, just use Nginx + PHP-FPM. There is no need to use Apache (unless you have other things that require Apache). Try to use PHP-FPM instead of mod_php, and set PHP-FPM appropriately according to the memory. The maximum number of processes (one process requires about 20-40M memory).
Recommendation:
1. Change the architecture to Nginx+PHP-FPM, and build the Nginx+PHP-FPM environment
2. Put all static files (JS, CSS, static pictures) on CDN. Now the price of CDN is very cheap. I recommend youpai.com and Qiniu
3. Do a good job of WordPress caching. Many WordPress blog pages can be statically cached. There must be many plug-ins to achieve this
If the compatibility problem is not major, you can consider upgrading the PHP version. 5.5 has huge performance improvements.