memory consumption on multiple wordpress instance

Posted May 26, 2016 2.8k views
Server OptimizationWordPressLEMPUbuntu 16.04

i want to know, if i install multiple wordpress instance through nginx virtual hosts, will they consume ram individually? or PHP will consume as 1 instance?

for example 4 virtual host - Plain HTML - wordpress - wordpress - PHP based application

3 out of 4 required PHP. so the PHP consumption will be like 1 central instance or each will eat RAM separately?

also is there any way to have and on single wordpress install?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

You can do it both ways, where by you have a dedicated instance for each site that uses PHP or one master PHP that spawns children. In your case you are looking to conserve memory usage so you want to have one master process that spawns children as necessary.

The way you define that is by setting each one of your php-fpm pools to be ondemand

pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200

This will given you one process and spawn as necessary. This will also limit the maximum number of children to 5 and will leave each one spawned for 10 seconds before killing it so that it can serve other requests. Each process will also be terminated when they have either been idle for 10 seconds or if they have processed 200 requests and you can change these variables based on your memory consumption.

The drawback to this is that you will have an initial lag when the first process needs to be spawned, but it doesn’t seem like you are worried about that in this case.

If you want to host the same blog from multiple subdomains you can just set that up in Nginx config:

  • @moisey
    thank you so much. really appreciate your help.

    now would you tell me how can i have a wordpress blog like ( where is a simple HTML site.

    thanks in advance again.

    • In most cases if you setup your virtual host the right way you can just create a directory called blog/ in your web root and put your blog there while all of your other content can reside inside of the regular web root directory and then you will be able to browse as your main site, and as your blog.