Friday, July 14, 2017

Reducing Memory Usage by Apache and MySQL in a 512MB VPS

DZone Database Zone
Reducing Memory Usage by Apache and MySQL in a 512MB VPS

Installing with the default Apache and MySQL configurations, you end up with far too many idle Apache threads, and MySQL is the largest memory user by far. The default config of these two is maxing out my available 512MB in my VPS server:

/etc/apache2$ ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r %MEM %CPU RSS VSZ COMMAND 9.5 0.0 49904 720256 /usr/sbin/mysqld 6.7 0.0 35620 286860 /usr/sbin/apache2 -k start 6.5 0.0 34452 283524 /usr/sbin/apache2 -k start 6.2 0.0 32692 283012 /usr/sbin/apache2 -k start 5.9 0.0 31276 283116 /usr/sbin/apache2 -k start 5.8 0.0 30896 282652 /usr/sbin/apache2 -k start 5.0 0.0 26724 282588 /usr/sbin/apache2 -k start 4.8 0.0 25204 279552 /usr/sbin/apache2 -k start 4.8 0.0 25200 279552 /usr/sbin/apache2 -k start 4.7 0.0 25156 279508 /usr/sbin/apache2 -k start 4.4 0.0 23216 279540 /usr/sbin/apache2 -k start 2.8 0.0 15136 278400 /usr/sbin/apache2 -k start 0.7 0.0 3968 90908 sshd: myuser [priv] 0.4 0.0 2564 61312 /usr/sbin/sshd -D 0.4 0.0 2264 33188 init 0.3 0.0 2060 18128 -bash ... /etc/apache2$ free total used free shared buffers cached Mem: 524288 476496 47792 68220 0 260764 -/+ buffers/cache: 215732 308556 Swap: 0 0 0

From tips in this article, I reduced down the Apache threads and now we’re at:

No comments:

Fun With SQL: Functions in Postgres

DZone Database Zone Fun With SQL: Functions in Postgres In our previous  Fun with SQL  post on the  Citus Data  blog, we covered w...