Note that there are some explanatory texts on larger screens.

plurals
  1. POScaling Nginx, PHP-FPM and MongoDB
    primarykey
    data
    text
    <p>I am looking for the best way to scale a PHP application under Nginx using PHP-FPM. I am looking at a concurrency of about 1200. Currently, anything over 400 starts to get slow response times. Response size is generally very small, but a few may be fairly large. Request sizes are usually small except for a select few.</p> <p>Things are fast up until it is under a heavy load. Response times crawl down to anywhere between 2 and 50 seconds. Under a light load, response times vary between 100 and 300 milliseconds.</p> <p>Server setup is 2 servers. Load balancer in front, PHP-FPM, Nginx and MongoDB on both boxes. One server runs the mongod master and arbiter, the other runs the slave (unless failover occurs). I know best practices with Mongo, but I don't have enough servers to have dedicated database servers.</p> <p>There is still quite a bit of ram free and the last 1 minute load average never gets above 0.7. They're 8 core boxes with 16 gigs of ram each so this shouldn't be the bottleneck. Mongo isn't sweating at all and Nginx and PHP-FPM don't seem to be either. I've checked top statistics and MongoDB using db.serverStatus().</p> <p>My question is, given my concurrency, do my Nginx fastcgi settings look correct, and is there anything else that I may be missing even if it doesn't have anything to do with Nginx settings?</p> <pre><code>fastcgi_connect_timeout 60; fastcgi_send_timeout 180; fastcgi_read_timeout 180; fastcgi_buffer_size 128k; fastcgi_buffers 4 256k; fastcgi_busy_buffers_size 256k; fastcgi_temp_file_write_size 256k; fastcgi_intercept_errors on; </code></pre> <p>Would a low "ulimit -n" slow this down? Mongo uses about 500 to 600 connections when under a heavy load. Ulimit settings are as follows:</p> <pre><code>core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 147456 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 147456 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited </code></pre> <p>FYI, I will be upping "ulimit -n" when load testing for 1200 concurrency.</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload