Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a LEMP setup (Ubuntu 12.04, Nginx, Mysql, PHP 5.3 and APC) and I have 30 sites hosted on it. They all are wordpress sites. It uses about 1GB RAM. Is this normal? I thought nginx would use less ram than apache would. Each site only receive about 200 hits daily

This is the top

top - 04:46:39 up 12:27,  1 user,  load average: 0.00, 0.03, 0.00
Tasks:  40 total,   1 running,  39 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,   788356k used,  3405948k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0  2496 1404 1168 S    0  0.0   0:00.29 init
 1179 root      15   0  2328  896  712 S    0  0.0   0:00.00 cron
 1241 mysql     15   0  158m  48m 5968 S    0  1.2   5:33.31 mysqld
 1271 syslog    15   0  2456 1216  548 S    0  0.0   0:00.06 syslogd
 1320 root      18   0  5496 2124 1712 S    0  0.1   0:00.00 sshd
 1341 root      25   0  5832 1736  292 S    0  0.0   0:00.00 nginx
 1342 www-data  18   0  6300 2892  892 S    0  0.1   0:02.54 nginx
 1343 www-data  18   0  6332 2840  884 S    0  0.1   0:02.48 nginx
 1345 www-data  18   0  6300 2840  884 S    0  0.1   0:02.39 nginx
 1347 www-data  15   0  6300 2848  892 S    0  0.1   0:01.98 nginx
 1349 root      18   0  539m 4252 1452 S    0  0.1   0:00.01 php-fpm
 1441 root      17   0  5764 1760 1404 S    0  0.0   0:00.03 master
 1449 postfix   18   0  5916 1868 1472 S    0  0.0   0:00.02 qmgr
 1455 snmp      18   0  8688 3772 2160 S    0  0.1   0:00.04 snmpd
 1504 root      23   0  2448  876  700 S    0  0.0   0:00.00 xinetd
 3144 root      18   0  4360 1332  996 S    0  0.0   0:00.08 ntpd
 5708 www-data  16   0  554m 125m 108m S    0  3.1   0:03.50 php-fpm
 5709 www-data  15   0  553m 118m 101m S    0  2.9   0:02.51 php-fpm
 5710 www-data  15   0  559m 134m 110m S    0  3.3   0:03.25 php-fpm
 5711 www-data  15   0  548m 103m  90m S    0  2.5   0:02.39 php-fpm
 5712 www-data  15   0  543m 117m 110m S    0  2.9   0:02.86 php-fpm
 5713 www-data  15   0  542m  93m  87m S    0  2.3   0:02.16 php-fpm
 5714 www-data  15   0  546m 108m  99m S    0  2.7   0:01.88 php-fpm
 5715 www-data  15   0  559m  92m  69m S    0  2.3   0:02.29 php-fpm
 5720 www-data  15   0  555m 128m 110m S    0  3.1   0:03.24 php-fpm
 5721 www-data  16   0  542m 101m  95m S    0  2.5   0:03.63 php-fpm
 5722 www-data  15   0  548m 101m  89m S    0  2.5   0:02.81 php-fpm
 5723 www-data  15   0  556m  94m  74m S    0  2.3   0:02.96 php-fpm
 5726 www-data  15   0  554m  93m  75m S    0  2.3   0:03.43 php-fpm
 5727 www-data  15   0  542m  93m  87m S    0  2.3   0:02.03 php-fpm
 5728 www-data  15   0  546m  97m  87m S    0  2.4   0:03.56 php-fpm
 5729 www-data  15   0  552m 131m 115m S    0  3.2   0:02.40 php-fpm
 5751 www-data  16   0  544m  91m  83m S    0  2.2   0:02.29 php-fpm
 5752 www-data  15   0  547m 104m  93m S    0  2.6   0:02.85 php-fpm
 5753 www-data  15   0  556m 110m  90m S    0  2.7   0:01.59 php-fpm
 5754 www-data  15   0  549m  94m  81m S    0  2.3   0:01.97 php-fpm
 5796 postfix   18   0  5780 1676 1340 S    0  0.0   0:00.00 pickup
 5797 root      15   0  8304 2796 2224 S    0  0.1   0:00.05 sshd
 5808 root      18   0  3136 1784 1320 S    0  0.0   0:00.00 bash
 5819 root      18   0  2368 1112  892 R    0  0.0   0:00.00 top
share|improve this question
    
use top to see what exactly is using your RAM. –  bodhi.zazen Feb 23 '13 at 0:30
add comment

1 Answer

It's normal to see 1 GB usage for 30 WordPress sites without a caching layer. For sites with a caching layer and with most visitors are not logged-in, it is not normal.

In most cases, it is not Nginx, but php-fpm and MySQL that use more memory than Nginx. Of course, Nginx is more efficient than Apache. While top is useful, you may use this scirpt to find which process uses how much memory. Please know that *ps_mem.py* requires 'root' or 'sudo' privilege.

If you'd like to reduce the memory usage, you may use a caching layer, such as Varnish. Alternatively, you may use application level caching, such as WP Super Cache or Batcache (both work fine with APC as WP Object Cache). I hope that helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.