Debian x86_64 + Nginx + PHP5-FPM optimization

Posted by Olal'a on Server Fault See other posts from Server Fault or by Olal'a
Published on 2010-10-04T11:40:41Z Indexed on 2011/01/06 16:55 UTC
Read the original article Hit count: 291

Filed under:
|
|
|

I used to have a VPS (512MB) from Linode and I was running nginx + php5-fpm (which comes with php5.3.3) on Debian Lenny (i686). The total memory usage was about 90-100MB.

Now I have another VPS (different hosting company) and I also run nginx + php5-fpm on Debian Lenny (x86_64). The system is 64-bit, so the memory usage is higher now, about 210-230MB, which I think is too much.

Here is my php5-fpm.conf:

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 300

That's what top command tells me:

top - 15:36:58 up 3 days, 16:05,  1 user,  load average: 0.00, 0.00, 0.00
Tasks: 209 total,   1 running, 208 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni, 99.9%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    532288k total,   469628k used,    62660k free,    28760k buffers
Swap:  1048568k total,      408k used,  1048160k free,   210060k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
22806 www-data  20   0  178m  67m  31m S    1 13.1   0:05.02 php5-fpm
 8980 mysql     20   0  241m  55m 7384 S    0 10.6   2:42.42 mysqld
22807 www-data  20   0  162m  43m  22m S    0  8.3   0:04.84 php5-fpm
22808 www-data  20   0  160m  41m  23m S    0  8.0   0:04.68 php5-fpm
25102 www-data  20   0  151m  30m  21m S    0  5.9   0:00.80 php5-fpm
10849 root      20   0 44100 8352 1808 S    0  1.6   0:03.16 munin-node
22805 root      20   0  145m 4712 1472 S    0  0.9   0:00.16 php5-fpm
21859 root      20   0 66168 3248 2540 S    1  0.6   0:00.02 sshd
21863 root      20   0 66028 3188 2548 S    0  0.6   0:00.06 sshd
 3956 www-data  20   0 31756 3052  928 S    0  0.6   0:06.42 nginx
 3954 www-data  20   0 31712 3036  928 S    0  0.6   0:06.74 nginx
 3951 www-data  20   0 31712 3008  928 S    0  0.6   0:06.42 nginx
 3957 www-data  20   0 31688 2992  928 S    0  0.6   0:06.56 nginx
 3950 www-data  20   0 31676 2980  928 S    0  0.6   0:06.72 nginx
 3955 www-data  20   0 31552 2896  928 S    0  0.5   0:06.56 nginx
 3953 www-data  20   0 31552 2888  928 S    0  0.5   0:06.42 nginx
 3952 www-data  20   0 31544 2880  928 S    0  0.5   0:06.60 nginx

So, the question is there any way to use less memory? Btw, I have 16 cores and it would be nice to make use of them...

© Server Fault or respective owner

Related posts about nginx

Related posts about debian-lenny