I think many friends, like me, couldn't resist the temptation of low prices and bought a VPS with small memory. However, the side effect of low price is low speed, which is inevitable (if you have low-price and high-quality options, you might as well share them~). Today I will talk about the simple optimization of small memoryVPS. Of course, the premise of the discussion is that you install the KLOXO panel. If you choose the LNMP installation package, you don't need to look down.
[Optimization 1]MySQL optimization
Optimization method:
First enter the /etc directory and edit the my.cnf
command : First cd /etc, then vi my.cnf
Add the following three lines under [mysqld]:
skip-locking
skip-bdb
skip-innodb
After saving, restart MYSQL
Command: /sbin/service mysqld restart
Now use top to see if the memory usage has dropped below 100M?
Detailed explanation of the function:
Use the MySQL option of –skip -locking to avoid external locking
Load the –skip-bdb –skip-innodb parameter to avoid memory waste
[Optimization 2] Switch website program
Optimization method:
You can see the following two pictures, which are screenshots before and after switching website program. The effect of switching to lighttpd is also immediate.
[Others] There are other optimizations that can also reduce memory usage. For example, do not load any modules that are not needed by apache, and manually modify httpd.conf yourself; there are also djbdns for dns, and bogofilter for spam. If you do not need these two, just turn them off in the service; there are also some things that are not very necessary: imap , qmail, iptables, etc., if they are all turned off, it is estimated that there will be no problem if the memory is reduced to about 50.
[Postscript]Actually, these optimization methods I mentioned are just superficial, and experts can only laugh and say nothing. However, the effect of this operation is indeed obvious. As for the VPS I used in the picture above, with 128MB of memory, without optimization, a KLOXO basically takes up all the memory, so the optimization is necessary.