Phenomenon: Both Nginx and applications are on the same server (4 GB memory and 4-core cpu). The nginx cache memory is configured as 1 GB, nginx accesslog is enabled, and the performance script of the Image Terminal page is run, it is observed that there are more than 90% misoperations in the accesslog, And the nginx cache does not play a role. It increases the nginx cache memory to 2 GB and clears the cache to run the performance script again, the MISS status in accesslog still accounts for the majority, and the memory space of the application server is basically used up.
Solution: Separate nginx from the application, place nginx on one server, move the application package to another server (6 GB memory, 8-core cpu), and run the script on the Image Terminal page, the nginx cache memory is configured with 2 GB, and the response has been raised. The HIT status in accesslog accounts for 90% or more. It indicates that the nginx cache zone plays a role.
The main reason is that the nginx cache zone is not enough when it is set to 1 GB. When it is adjusted to 2 GB, the 2 GB memory configured by nginx does not work because the server also stores applications in the memory and the system also needs resources. When nginx and the application are separated, the resources are sufficient, and the nginx cache can also play a role.
Nginx details: click here
Nginx: click here
Deployment of Nginx + MySQL + PHP in CentOS 6.2
Build a WEB server using Nginx
Build a Web server based on Linux6.3 + Nginx1.2 + PHP5 + MySQL5.5
Performance Tuning for Nginx in CentOS 6.3
Configure Nginx to load the ngx_pagespeed module in CentOS 6.3
Install and configure Nginx + Pcre + php-fpm in CentOS 6.4