How to lower GIGAZINE's LoadAverage from "27" to "2"
It was not because the physical trouble occurred in the server for the past 3 days because it was superior because the number of viewers was simply filled with crowds and doubled in each hour. LoadAverage is an average value of "27.1" in 15 minutes when it is severe. It is even higher if it is the instant maximum wind speed ...... Obviously bad.
So, it was OK with Apache's default setting until now, but at last it has been forced to change to a setting for a high-load site.
Therefore, the actual countermeasure method is as follows. It would be great if you could refer it as a way to ease the high load of dynamic sites near 300,000 PV per day.
First of all, as a premise, DNS reverse lookup and extra reading of .htaccess etc were stopped. What is written on the following page has been executed.
@ IT: Practice of Apache performance tuning (1/2)
In this state, the load was "27" on average for 15 minutes.
Also, please see the website below for what LoadAverage means.
Human power search Hatena - Please tell us about the load average displayed by Linux top command
For the determination of bottlenecks we referred to the following articles.
How to easily identify the server and PC bottlenecks (Linux): ITpro Watcher
Then again, the load reduction epicenter starts.
1. Cache to MySQL not to connect each time
The initial cash holding time was 1 minute, but I made various adjustments and kept it for 60 minutes. This is the function of ExpressionEngine itself used in GIGAZINE.
Data Caching and Performance - ExpressionEngine Documentation
As a result, the server resource that MySQL eats is reduced to dirty, and it is almost impossible to connect to the database and throw an error. LoadAverage goes from 27 to 17.
2. Put the image to another server for load balancing
As a result of various investigations, loading of images became more than half of the total access, and by transferring this to another server and restraining it, we aimed at increasing reaction speed and load reduction.
As a result, the load is reduced to one-third by simply setting the title logo image and the RSS icon image, which are most frequently read, to separate servers. In addition, all images are now put in another dedicated server "gigazine.jp". LoadAverage is now from 17 to 8.
3. Weight reduction of templates
Reduce articles displayed on the top page at once and remove items that do complicated processing. Among them, the calendar was cut because the structure was complicated and the consumption of resources was leaping. This further halves the load. LoadAverage goes from 8 to 4.
4. Review of httpd.conf
By first setting "KeepAliveTimeout" to an extreme value of "1", we prioritize people to judge coming up one after another. Because, once I started, "queue" grew steadily and it was getting into a vicious circle that the CPU was fully operational without lowering the load. In short, we did not consume resources of the server uselessly, so we did not stay.
Also, in accordance with this change process settings (prefork MPM) also changed. As a result of drastically reducing access to MySQL, there was considerable free space in memory, so we increased MaxClients and ServerLimit. Divide the available memory by the amount of memory used per Apache process and determine the optimum number. By doing this, LoadAverage did not rise even under high load, and the sensible speed was raised.
@ IT: Web server optimization by httpd.conf (2/3)
Since consumption resources per process are considerably lowered, it seems that there is still room for improvement around here. Currently, the most concentrated access is from 12 o'clock in the day to 13 o'clock in the daytime, and it seems necessary to adjust so that load can not be applied even in that case so that the server resources can be effectively utilized.
As a result, we succeeded in constantly lowering LoadAverage from 4 to 2 from 22 o'clock to 1 o'clock time which is the second loading time period.
Would not it be possible to improve the speed by "Zend Optimizer" or to upgrade Apache to version 2.2 to cache all dynamic results or load balancing?
Zend Optimizer 3
Performance improvement of Web site with Apache 2.2! (1/3) - @ IT
Also, it seems that MySQL itself needs to be reworked.
【MySQL Watch】 Review the 14th server setting and derive MySQL performance: ITpro
At one point I was in a desperate mood as "Do you have to move to a new server?", But it seems to be able to hold on. It is salvation to be so-called "happy scream". Still, I am thinking about moving to a new server.