I’ve trimmed down my apache conf to work ok for a small site, but after uploading my exported data from my old site to my new, the 4x apache2 processes have grown considerably and consumed all my VPS memory. Knowing nginx has a much lighter footprint, I wondered what it would look like in comparison.
Here’s the memory usage after completing my exported data file imports – I get that after completing this imports to the new site this is the memory usage of the apache processes after load from importing about 20x 10MB xml export files. At idle after a restart the memory usage does start considerably lower, but here’s where I’m at right now:
$ ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r %MEM %CPU RSS VSZ COMMAND 32.2 1.7 169228 904300 /usr/sbin/mysqld 24.5 1.2 128684 385360 /usr/sbin/apache2 -k start 20.2 0.2 105968 355004 /usr/sbin/apache2 -k start 18.4 4.0 96740 352540 /usr/sbin/apache2 -k start 2.5 0.0 13144 283312 /usr/sbin/apache2 -k start
So following the guide here just to install nginx and the fastcgi php, and then here for WordPress specific config, here’s what it looked like on restart:
$ ps -eo pmem,pcpu,rss,vsize,args | sort -k 1 -r %MEM %CPU RSS VSZ COMMAND 9.3 0.4 49124 576488 /usr/sbin/mysqld 6.0 0.0 31516 235504 php-fpm: pool www 4.5 0.0 23860 232660 php-fpm: pool www 2.6 0.0 14032 230016 php-fpm: master process (/etc/php5/fpm/php-fpm.conf) 0.5 0.0 2804 86472 nginx: worker process 0.3 0.0 2004 86128 nginx: worker process 0.3 0.0 2004 86128 nginx: worker process 0.3 0.0 1988 86128 nginx: worker process 0.3 0.0 1900 33188 init 0.2 0.0 1452 85832 nginx: master process /usr/sbin/nginx
This is looking better, still need to work on getting the mysql usage down, but at least now I’m not maxed out:
$ free total used free shared buffers cached Mem: 524288 431192 93096 68180 0 259440 -/+ buffers/cache: 171752 352536 Swap: 0 0 0