1

I am using magento with php5-fpm , Nginx, APC, and Varnish. When there is varnish hit, the load time is very good. But on varnish miss, the site takes toomuch time to load. I have seen through htop that CPU goes under a lot of load and Ram and swap become full.

I have a core2duo with 512mb Ram. I think there should be some memory issues. Please suugest me how should i configure the different parameters of php5-fpm, nginx, APC, Mysql.

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
MJQ
  • 111
  • 3

2 Answers2

2

Before tweaking php-fpm or nginx parameters, you need to check /etc/default/varnish file and see how much memory you have assigned to varnish (considering you have configured varnish to use malloc which uses RAM to store cached data.

you have 512MB of RAM, so you need to set that value accordingly. It should not be on higher side.

Also make sure that your server is not swapping, if it does, then please increase your RAM.

Two more things to check. 1. check /etc/nginx/nginx.conf for worker_process it should be 1 if you have a single CPU.

  1. check /var/log/php-fpm.log and make sure php-fpm is not running out of resources.
sandeep.s85
  • 2,119
  • 1
  • 18
  • 27
  • I have a core2duo(4CPUs), so i have set worker processes to 4, I have seen in php-fpm log this a lot "server reached pm.max_children setting (7), consider raising it". – MJQ Apr 26 '13 at 07:33
  • I have malloc,256m in varnish. Is it fine? – MJQ Apr 26 '13 at 07:35
2

I am not sure if you have four CPU's. you can check cat /proc/cpuinfo for that. the nginx worker_process should be set one less than the no of processors on your machine. So if you have two cpu's set it to 1.

each worker_process can handle the no of connections mentioned in the worker_connections that should be 1024 by default.

So max cleints that a nginx web server can handle is = worker_process * worker_connections. Also keep in mind the keep alive connections if you have enabled that in nginx. So from my point of view nginx is not problematic here.

You should read carefully the max_children and parent processes that should be forked by php-fpm according to your server CPU/RAM. then set it accordingly in php-fpm.conf

If you have set 256M in varnish that means you are only left with 256M of RAM on server for other server tasks, which is very less.

You can set varnish's cache to file system instead of RAM. the performance won't be that bad but you will save your RAM on this.

Try this and see how it works.

sandeep.s85
  • 2,119
  • 1
  • 18
  • 27