Fastcgi / mod_cgi processes killing server!

Discussion in 'Installation/Configuration' started by paradoxni, Apr 15, 2011.

  1. paradoxni

    paradoxni New Member

    Good Morning,

    I have a virtual server with 8GB of ram, running ispconfig 3.0.2.1. A few sites running on this server have fastcgi enabled, however this appears to be killing the server for load and disk access! I keep having to restart apache/mysql to try an get the sites working at a normal speed, but it does not take long to suffer once again.

    Not all RAM is getting used and the server is not using swap, however load is consistently high.

    I found a post on this forum by someone with a similar issue suggesting that an issue with fastcgi opening too many connections was fixed in 3.0.3, but as of yet I cannot find what this setting is and how to check if I am being affected.

    Can anyone point me in the right direct?

    thanks,
     
  2. paradoxni

    paradoxni New Member

    Each Vhost appears to have PHP_FCGI_MAX_REQUESTS=5000 - is this normal PER site?
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    The fastcgi default settings have been improved in the last versions. Please update your server to a current ispconfig version (3.0.3.3). Then edit a value in the website settings and click on save so that the vhost gets rewritten and check if this helps.

    Also make sure that you install a php binary cache like xcache or eaccelerator.

    Thats should be ok. It means that a fastcgi process is terminated after 5000 requeststs and a new one gets started to avoid problems with scripts that eat up your memory.
     
  4. JeffryL

    JeffryL New Member

    I also notice php-cgi is consuming a lot of memory. And instead of the topic starter I don't own a server with 8GB but have only 512. I've also installed php-apc with default configuration (i.e. 32MB). Only a few hits on two sites using php and my memory usage extends to the maximum (both sites running wp) and swap consumption raises to around 400K... and of course this results in a high load.

    I use Ubuntu 10.04. Is there some way I could prevent or reduce memory usage by php?

    Using mod-php doesn't show the same symptoms and both load and memory are acceptable. For now Fast-cgi results in so many problems I'm using mod-php. But I would prefer using fastcgi though.
     
    Last edited: Apr 18, 2011
  5. JeffryL

    JeffryL New Member

    Solved by removing apc (Ubuntu 10.04).
     
    Last edited: Apr 18, 2011
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    I recommend 2GB RAM for a ISPConfig server. Using fastcgi means that there is at least one php process per website, so 512 MB will not be enough. What you can try is to use php-cgi with suexec instead, it is slower but uses less memory then fastcgi, as long as your sites are low traffic.
     
  7. JeffryL

    JeffryL New Member

    Yes, I was already thinking about an upgrade. But for now it's solved by removing php-apc. The server load stays below 1 (instead of 10!) before. Bit slower perhaps, but don't really notice the difference though.
     
  8. JeffryL

    JeffryL New Member

    Also working for me is adding these lines to /etc/apache2/mods-enabled/fcgid.conf:

    Code:
    FcgidMaxProcesses 3
    FcgidMaxProcessesPerClass 3
    FcgidMinProcessesPerClass 1
    This results in less php-cgi processes. It's good to keep in mind though that the FcgidMinProcessesPerClass seems to override the FcgidMaxProcesses (afaik). In my case having 5 websites configured with suexec (and require a different user php-cgi start) still results in 5 processes. Good thing about this, is that requests do not have to wait for other processes to be quit. But if you run many websites this still may still result in many php-cgi processes.

    And in apache2.conf:

    Code:
    ServerLimit 6
    in the <IfModule mpm_worker_module> section.

    More info about configuring for low memory over here:

    http://blog.fosketts.net/2010/07/30/high-performance-memory-apache-php-virtual-private-server/
     
    Last edited: Apr 24, 2011

Share This Page