So I have it all running, no errors, but I'm trying to optimise it for a 4gb Rackspace Cloud server.

This is what I have currently:


pm.max_children = 200
pm.start_servers = 20
pm.min_spare_servers = 20
pm.max_spare_servers = 60
pm.max_requests = 100


worker_processes 4;
events {
        worker_connections 2000;
        # multi_accept on;


memory_limit = 16m;

Just doesn't seem to perform as well as my Apache2 setup with the same server when runnning

ab -n 30000 -c 350 http://domain.com/

You will need to tweak and adjust until you find your sweet spot but "pm.max_requests = 100" seems very low. Something like 500 or 1000 or maybe more, might be better. Fastcgi will have to kill and respawn children after each one serves pm.max_requests.

PHP memory should not directly impact speed and is the same for both test targets or yours but "memory_limit = 16m;" is low. Start at 256M. You have 4GB of RAM so why limit PHP to a measly 16mb max?

| improve this answer | |
  • I'd also add, I think you do not need 60 spare servers, fewer would be enough, but do raise max_requests. – petermolnar Sep 27 '11 at 14:08
  • I thought that php's memory_limit was the limit on memory that a php process could use, if the php script he runs doesnt require more memory why increase it? in fpm-php this means the worker process would consume more memory and limit the number of spawned process or did I get it wrong? – Purefan Apr 15 '13 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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