We've written about the Impact of CPU speed on websites running PHP in general. This page is dedicated to providing information about specific CPU models based on Phoronix OpenBenchmark PHPBench test and our own internal tests that we've found to have a decent correlation between CPU benchmark performance and the processing speed of real-life PHP websites.
What is PHPBench?
Performance comparison of CPUs for PHP workload
How to read the results
Chart is presented in a form of a RATIO of PHPBench scores between a selected BASELINE CPU (100%) and a compared model. Baseline CPU is marked with performance = 100%. That means that if a CPU taken for comparison has a score of 150 it has a 50% better PHPBench score than the baseline model.
Cheap webhosting
Common webhosting
VPS / Above avg. webhosting
Small, high-freq servers
High performance setups
Specialized webhosting
Best CPU for PHP
The best CPUs for PHP based on PHPBench are Intel i9 gaming/workstation processors (i9-9900K, i9-9900KS, i9-10700K, i9-10900K).
These CPUs often run on frequencies up to 5GHz which is almost 1GHz faster that the fastest Xeons and AMD processors get. As PHPBench is single-thread oriented test, CPU frequency seems to be the most important factor for final results.
The Best CPU for PHP-
The Best CPU for PHP workload
Our i9-9900K score was 807.000 which puts it among the top results. Also, all internal tests have shown it has a significant impact on the perfomance of PHP.
Chart at least in part explains why Premium Wordpress Hosting provider Kinsta was so happy when Google Cloud rolled out C2 instances with Xeon Gold High freq. CPUs (probably Gold 6254 or 6242R that have 3.1GHz base and 4.0GHz boost clock) as they saw significant improvements (chart).
Based on some unoffical comments another premium Wordpress hosting provider (Serverbolt) that takes special pride in being one of the fastest is using Xeon E5-2687W v4 CPUs - a workstation line with very high frequencies for CPUs with that many cores.
So there is quite some evidence that for PHP workloads high frequencies are more than welcome.
But wouldn't a Xeon Gold 6258R with 28c/56t (@2.7GHz) be better than 8c/16t (@5GHz)?
Saying that i9-9900K is the single best option for PHP isn't entirely correct. It is the fastest for processing a single PHP page. But in cases of serving huge web traffics and lots of parallel requests it could turn out that some Xeons or new AMD Threadrippers could win in a benchmark that would test "First to complete 50.000 served pages".
We can conclude without much doubt that i9-9900K would win in all cases that are < 10 parallel requests (hyperthreading is not the same as actual cores and does not scale 1:1, but closer to 30%. So 8c/16t gives us app. 10.4 effective cores). We can also count on i9-9900K with its unlocked multiplier to run all cores 4.6-5GHz where Xeons are locked and will run at app. 2.7-3.1GHz under load. So a break even point for parallel requests would be somewhere between 10.4 and 36.4. Where exactly depends on the exact speeds of CPUs under full load and also TTFB of webpage used for benchmark.
To be a bit more specific about this comparison:
- If your webpage TTFB for uncached requests is under 1 sec, this CPU is the fastest option for traffic <= 10 requests/sec.
- A request served by i9-9900K will have a lower TTFB (due to lower "server response time") than any other CPU (this could be an important feature for SLA targets etc.).
- It will win a core-for-core battle against any other CPU.
- It can be used in horizontally load-balanced mode in setups that could equal or even exceed number of cores of bigger CPUs. You can get 8x i9-9900K's ($500 in early 2020) for a single Xeon Gold 6258R ($3950) and have 64c/128t at 5GHz againts 28c/56t at 2.7GHz - app. 4x the performance in total GHz, with added redundancy in case of a machine failure or maintanance, but also a bigger power consumption and space required.
Does it matter that i9 CPUs do not support ECC memory?
- It is a CPU specialized for gaming and short-term workstation tasks, not webhosting. For machines running 24/7 hosting providers prefer Xeon and Epyc processors.
- An extra part of i9 dominant "1-10 cores" performance can come from overclocking which is also often not an option in 24/7 and 99.9%+ uptime SLA industries.
- ECC improves system stability, esp. important for very long computations running 24/7 for multiple months or even years between restarts. (Though we run i9-9900K as a PHP/webserver and did not encounter any stability issues in a year, we have at least one Xeon CPU in our PHP-cluster that provides an extra layer of stability to this setup. For this task we use "workstation" CPUs like E5-1650v4, E5-2690 that use ECC, but also have a relatively high frequency to provide a solid temporary solution.)
- ECC memory is highly recommended for DB/mySQL workload. That is part of the reason why i9 can not be used in a "all-in-one" hosting package that includes ECC support for accompanying database.
- If NAS for CDN storage (static files: images, pdfs...) is running on ZFS software RAID, ECC RAM is highly recommended.
So there are couple of things that would need to be considered when deciding about i9 for PHP/webserver tasks. What would be the closest ECC-compatible options?
- Best CPU for PHP with ECC would be an Intel Xeon E-2278G or E-2288G.
- Another solid option for smaller setups "on the budget" would also 4c/8t CPUs like E3-1245v5/v6. But in case of using these in a shared hosting environment you'll probably have "noisy neighbour problems".
Summary
What in short makes a CPU good for PHP? Higher the frequency, better for the task. Look for the combination of the highest base frequency for the lowest number of cores that can serve your web traffic (and your wallet).
A list of Phoronix OpenBenchmark PHP Bench results along with raw processing numbers published on best single thread perf. CPUs by Passmark Benchmark serve as a good starting point at which CPU will perform well for PHP tasks.
If you wish to have a TOP-PERFORMANCE processor for PHP, you pretty much have to have it in a multi-server setup. (at least Server 1: NGINX/PHP/CDN + Server 2: DB)
If you'd like to have a lot of really high-freq cores one solution is to implement a private cloud with a load balancer for horizontal scaling and an option to add additional PHP servers as backend servers. This kind of setup starts at ~$500/month (EURO VPS). Add selected hardware, increased complexity and required server administration and it will swallow a yearly small-VPS hosting plan in a couple of hours. Higher price and added complexity is why this is often out of consideration sets of SMBs.
An example of running a Openbenchmarking test pts/phpbench
Phoronix Test Suite v9.2.1 Installed: pts/phpbench-1.1.5 System Information PROCESSOR: 2 x Intel Xeon E5-2640 0 @ 3.00GHz Core Count: 12 Thread Count: 8 Extensions: SSE 4.2 + AVX Cache Size: 15360 KB Microcode: 0x710 Scaling Driver: intel_pstate performance GRAPHICS: Matrox G200eR2 Screen: 1024x768 MOTHERBOARD: Dell 0KCKR5 BIOS Version: 2.5.4 Chipset: Intel Xeon E5/Core Network: 4 x Intel I350 MEMORY: 16384MB DISK: 400GB INTEL SSDPEDMW400G4 + 159GB PERC H710P + 3000GB PERC H710P File-System: ext4 Mount Options: relatime rw stripe=16 Disk Scheduler: NONE OPERATING SYSTEM: Ubuntu 18.04 Kernel: 5.3.18-2-pve (x86_64) Compiler: GCC 7.5.0 System Layer: lxc PHPBench 0.8.1: pts/phpbench-1.1.5 Test 1 of 1 Estimated Trial Run Count: 3 Estimated Time To Completion: 5 Minutes [02:26 UTC] Started Run 1 @ 02:22:37 Started Run 2 @ 02:23:07 Started Run 3 @ 02:23:37 PHP Benchmark Suite: 387256 382935 380292 Average: 383494 Score Deviation: 0.92% Result compared to 154,623 OpenBenchmarking.org samples since 26 February 2011; median result: 68018. Box plot of samples: [|-----####!####--------------------*-----------*--*-----------*-----------------*------------------------*| * * ] This Result (91st Percentile): 383494 Intel Xeon E3-1230 v5: 314564 2 x AMD EPYC 7742: 495554 Intel Core i9-7960X: 675512 AMD EPYC 7351P: 295672 Intel Core i5-6500: 666000 Intel Xeon X5650: 217823 2 x Intel Xeon Platinum 8280: 646828