Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

PHP-FPM opinion needed: 1 pool for all, or 1 pool per site?

PHP-FPM opinion needed: 1 pool for all, or 1 pool per site?

dantesdantes Member
edited August 2012 in General

Hey,

I'm trying to find out what would be more efficient memory wise. Using one PHP-FPM pool for all the websites on the server, or to use a pool per site.

Here is my experience so far...

The first logical thing that came up to my mind, is to use a "pool per site" structure. Because it makes more sense... I tried it on OpenVz. But then I ran out of memory pretty fast. It was before I figured out about the "ulimit -s" thing in OpenVz: http://www.lowendbox.com/blog/reduce-stack-limit-for-multi-thread-apps/

Anyway... I installed my next VPS using only one pool, under "www-data" user. It works fine, however I noticed that the PHP-FPM processes take 2X times more memory in that setup. However, it may be due to having more traffic as well...

The specs for both servers are OpenVz 512Ram with 4 cores.

On which circumstances would you use one-pool-for-all? And when would you use one-pool-per-site?

Thanks.

Tagged:

Comments

  • NickMNickM Member
    edited August 2012

    I would use one pool per site if I need them separated from each other. For example, if I were letting a couple of other people host their sites on my server, I would give them each a pool under their own user account so that they can't access each other's files.

    Lead Developer - HostGuard Control Panel

  • If you're the administrator of all the sites, go one pool for all. Also look into using ondemand manager, you won't have unneeded PHP processes unless people are accessing the site.

    "We are in a prison drama. This is like The Shawshank Redemption, only with more tunneling through shit and no fucking redemption."
  • @ihatetonyy said: If you're the administrator of all the sites, go one pool for all.

    How does that prevent PHP from accessing other users data?

  • @bdtech said: How does that prevent PHP from accessing other users data?

    Because each pool runs under different user with different permissions...

    ===============================================

    Anyway guys. Here is what I found. I hope you'll find it useful...

    The best way to make the most out of your LEB, is actually by using as many POOLS as possible.

    I repeat...

    You should have as many PHP-FPM pools, as possible... I work now in a setup that creates a pool per website. That way, the memory consumption is lower...

    Here is what happens. Whenever a PHP process gets a request, it forks itself. Which means it creates a clone of itself.

    So if you have 10 websites on the same pool, each PHP process contains cache/data/etc... for all the websites...

    Bottom line... My PHP-FPM processes used to weigh 50MB in the RAM. Now their 1MB-2MB.

    I hope it helped...

  • aatish910aatish910 Member
    edited August 2012

    I also use one pool per website. Since, each pool runs as the owner of the website, permissions related problems automatically vanish. My LEMP script also does the same.

  • i use one pool per site

Sign In or Register to comment.