happened to see this post "written before the small scale and low performance and low flow website design principle", re issued to micro-blog caused a little stir, think it necessary to do a simple optimization practice indicated that the Linode VPS for example, lest someone asked me, also some hits):
assumes that you now have a basic VPS available, the basic memory 512MB. All refer to the official installation guide will provide the LAMP combination of running up, operating system Ubuntu, Web server, Apache database, MySQL, then PHP, and the need for the implementation of the application software, WordPress, Drupal or OpenCart is what, step by step configuration, can normal browsing. One of the benefits of operating in accordance with the official guidance document is that it will include some basic optimizations. Not too big a mistake.
Once the application is ready,
logs into the operating system and collects the baseline data through the basic operating system commands, such as top / iostat / free, to record. The more comprehensive the information, the more convenient it is for the latter. There is no magic in the optimization, only the reasonable method.
1. memory related adjustment
internal testing, or smaller range, may not be too much of a problem. As soon as the number of visits increases a bit, the machine’s response may be a bit slow. For VPS, the first step is to adjust the memory usage of each component. Because memory is limited, the use of memory must be a bit more careful. Remember, once memory runs out, a portion of memory calls are pressed onto the disk, and the system load goes up and it usually hangs up.
generally speaking, for the LAMP environment, the following areas should be noted:
Memory related adjustments for the
The value defined by the
in the PHP5 php.ini configuration file is 16MB by default, which defines the maximum memory size for a single PHP script (to the point of) memory_limit. If a program needs more memory than this restriction, the visitor is most likely to experience a HTTP 500 error, and check the Web server error log as well. In most cases, this value needs to be adjusted accordingly. For example, set to 32MB, whether appropriate, need to do observation. There is an empirical method of observing the output of the top command, looking at the value of the SHR field of the corresponding process, and actually always trying to be a little bit larger. But not too big, once there are individual procedures written bad, call the time to occupy too much resources, will lead to VPS hang up.
often asks, "does this server run" Web "?