PHP-FPM Pool options " Best Values " for Managing CPU Usage in Shared Hosting Environment

Operating System & Version
CENTOS 7.9
cPanel & WHM Version
v94.0.4

risecompany

Member
Mar 10, 2015
14
0
51
Egypt
cPanel Access Level
Root Administrator
Hi,

We have a dedicated server 8 Core / 16 Thread with 16 GB RAM that manage 100 client . We need to decrease the load on processor use, Ram is not an issue to us!

Our question here Which of the values below if we customized shall decrease the load on CPU ? need answer
is it Max Requests ? is it Max Children ? is it Process Idle Timeout ? need answer
also decreasing this values or increasing it help for decrease the load on CPU ? need answer

PHP-FPM Pool options
Max Requests
cPanel Default: 20

Max Children
cPanel Default: 5

Process Idle Timeout
cPanel Default: 10

by the way we have many clients that use the hosting for emails only! but they also have scripts with poor coding or old version that are consuming the server.
so we need to customize the pool for them with out need any speed and there are no problem if there website is slow in performance.

-------------------------------------------

If we Changed Some clients to those values below,
are there any side effect or issues may effect on the whole server performance or effect other clients with that change? need answer


PHP-FPM Pool options
Max Requests
cPanel Default: 1

Max Children
cPanel Default: 1

Process Idle Timeout
cPanel Default: 1

-------------------------------------------

PLS Advice, Thanks.
 
Last edited:

risecompany

Member
Mar 10, 2015
14
0
51
Egypt
cPanel Access Level
Root Administrator
How to check Hyperthreading is on ? also need answers for the above questions, Thanks.

Code:
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3333.593
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3334.216
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 1
cpu cores       : 4
apicid          : 2
initial apicid  : 2
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 2
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3377.587
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 2
cpu cores       : 4
apicid          : 4
initial apicid  : 4
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 3
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3604.406
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 6
initial apicid  : 6
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 4
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3400.622
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 0
cpu cores       : 4
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 5
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3395.642
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 1
cpu cores       : 4
apicid          : 3
initial apicid  : 3
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 6
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3400.415
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 2
cpu cores       : 4
apicid          : 5
initial apicid  : 5
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:

processor       : 7
vendor_id       : GenuineIntel
cpu family      : 6
model           : 60
model name      : Intel(R) Xeon(R) CPU E3-1231 v3 @ 3.40GHz
stepping        : 3
microcode       : 0x28
cpu MHz         : 3224.023
cache size      : 8192 KB
physical id     : 0
siblings        : 8
core id         : 3
cpu cores       : 4
apicid          : 7
initial apicid  : 7
fpu             : yes
fpu_exception   : yes
cpuid level     : 13
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid xsaveopt dtherm ida arat pln pts md_clear spec_ctrl intel_stibp flush_l1d
bogomips        : 6799.61
clflush size    : 64
cache_alignment : 64
address sizes   : 39 bits physical, 48 bits virtual
power management:
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,235
2,422
363
cPanel Access Level
Root Administrator
In my experience, it's unlikely that any of the values you mention would decrease the CPU usage, unless you lowered them to the point you start limiting traffic.

To decrease CPU, you want to raise the RAM usage, which means getting more things stored in cache. It's much quicker for the system to use cached data than to read new values each time, so I would look toward caching if you wanted to free up CPU resources.
 

risecompany

Member
Mar 10, 2015
14
0
51
Egypt
cPanel Access Level
Root Administrator
In my experience, it's unlikely that any of the values you mention would decrease the CPU usage, unless you lowered them to the point you start limiting traffic.

To decrease CPU, you want to raise the RAM usage, which means getting more things stored in cache. It's much quicker for the system to use cached data than to read new values each time, so I would look toward caching if you wanted to free up CPU resources.
How could we raise the RAM usage?

Actually we selected some clients that we know them that they are using old scripts, also selected clients that their purpose from hosting is emails only and have sites consuming cpu, also we have some clients with poor scripts always been in Process Manager with much cpu using without need!

We changed their Pools Values to : Max Requests : 1 / Max Children: 1/- Process Idle Timeout: 1 + We Closed the Log errors / Error Reporting that was adding every second line inside error log file, Cause of old scripts are not compatible with php 7+, The log file size increased to huge numbers , We Found a client with 50 GB error log was using vbulletin v4 that are not compatible with 7.4 thus all the error log file was about php issues with that script. Another client also was sending many requests to phone app we changed Max Requests to 10 instead of 20 that was very good also to the load on cpu.

Finally We Solved our issue and cpu decreased about the half with out any issue and cpu stable again,
No Huge increase now on cpu as the load are playing around 0.3 ~ 2 ~ 4 before was 2 ~ 4 ~ 8.

The server is fine and no issue reported to us until now but we need to know more about php pool with best practice values.
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,235
2,422
363
cPanel Access Level
Root Administrator
We have some additional details about fine tuning the pool settings here, so I would recommend checking out that page for more details specifically related to that:

 

jndawson

Well-Known Member
Aug 27, 2014
346
38
78
Western US
cPanel Access Level
DataCenter Provider
We have some additional details about fine tuning the pool settings here, so I would recommend checking out that page for more details specifically related to that:

We've been using php-fpm for quite some time, now, and on our CloudLinux boxes we've been using lsapi. We've been moving accounts off of our older Centos6 boxes where most were using php-fpm and suexec with no issues, they've come with php-fpm enabled, and we saw no reason to change.

However, according to this, we may be redundant:


Should we shut off php-fpm?
 
Last edited:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,235
2,422
363
cPanel Access Level
Root Administrator
@jndawson - it's completely a personal preference so it's up to you. We've found that some users get better "out of the box" performance with lsapi than with PHP-FPM as there is less tuning involved. Give it a chance and see if you notice any differences on your machine - that's really the only way to know for certain if you'll experience a noticeable improvement.
 

jndawson

Well-Known Member
Aug 27, 2014
346
38
78
Western US
cPanel Access Level
DataCenter Provider
@jndawson - it's completely a personal preference so it's up to you. We've found that some users get better "out of the box" performance with lsapi than with PHP-FPM as there is less tuning involved. Give it a chance and see if you notice any differences on your machine - that's really the only way to know for certain if you'll experience a noticeable improvement.
We have php-fpm AND lsapi BOTH running on our accounts on our CL boxes. So, use one or the other? What about customers using WordPress Tool Kit? Will that break if we turn off php-fpm on each account?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,235
2,422
363
cPanel Access Level
Root Administrator
No, I would expect that to work fine. WordPress Toolkit requires PHP-FPM for the cPanel daemon to be running, but not for the webserver on the machine. Details on that can be found here:

 

jndawson

Well-Known Member
Aug 27, 2014
346
38
78
Western US
cPanel Access Level
DataCenter Provider
No, I would expect that to work fine. WordPress Toolkit requires PHP-FPM for the cPanel daemon to be running, but not for the webserver on the machine. Details on that can be found here:

Thanks, I missed the distinction between the two.
 

jndawson

Well-Known Member
Aug 27, 2014
346
38
78
Western US
cPanel Access Level
DataCenter Provider
Update: (I thought I had updated this but had not.)

Essentially, according to CloudLinux, if you use lsapi, then don't use php-fpm as they do basically the same thing and may conflict in certain situations.