I'm struggling to figure out the correct settings for my Ubuntu server.
It has 16 CPUs and 48GB of Ram. However, it seems to be taking a while to respond to requests. Recently, I switched to PHP-FPM and Apache 2.4 mpm_worker.
My mpm_worker.conf file:
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxClients 8000
MaxRequestsPerChild 10000
</IfModule>
My /etc/php5/fpm/pool.d/www.conf
settings:
pm = static
pm.max_children = 1200
pm.start_servers = 16
pm.min_spare_servers = 1
pm.max_spare_servers = 36
pm.max_requests = 800
What is the best way to go about figuring out the optimum values for the above settings and how do these two configuration files relate to one another? With Apache 2.4 and mod_php, you simply edit the mpm_prefork.conf file - However, with this setup, there are two separate configuration files that seem to have similar directive names.
A screenshot of top
with the above settings:
Other server details:
- It is a cloud server with SSD for disk space.
- There are multiple sites on the same server. However, the other hosts seem to be responding quickly.
- It is a Digital Ocean droplet that uses KPM.
- When I have 2,800 users on the site, requests can take up to 6 seconds. This is despite the fact that I am using Digital Ocean's load balancer to split requests between two servers (both of them are configured the same and both suffer from the same slowness).
A screenshot of my load balancer stats, which shows that I can't seem to get above 430 requests per second:
mybench.sh test results (dl speed exluded):
CPU model : Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz
Number of cores : 16
CPU frequency : 2399.998 MHz
Total amount of ram : 48303 MB
Total amount of swap : 1023 MB
System uptime : 6 days, 13:52,
I/O Tests...
IOPING Statistics:
10 requests completed in 9.0 s, 4.2 k iops, 16.3 MiB/s
min/avg/max/mdev = 139 us / 240 us / 447 us / 86 us
I/O Read Speed by hdparm...
Timing cached reads: 15068 MB in 2.00 seconds = 7541.02 MB/sec
Timing buffered disk reads: 1096 MB in 3.00 seconds = 364.79 MB/sec
I/O Read Speed, 100MB Testfile sequential read: 3400 MB/s
I/O Read/Write + CPU, 'gzip -9' 100MB Testfile: 87.1795 MB/s
I/O Write Speed 100MB 4KB Blocks: 324 MB/s
I/O Write Speed 100MB 16KB Blocks 434 MB/s
I/O Write Speed 100MB 64KB Blocks 404 MB/s
I/O Write Speed 100MB 1MB Blocks 433 MB/s