Klik-MALL.com
Blog
Development

Which are the fastest CPUs for PHP websites like Wordpress and Magento

The best CPUs for PHP based on PHPBench are Intel i9 gaming/workstation processors like i9-9900K

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?

PHPBench is a benchmark suite for PHP. It performs a large number of simple tests in order to bench various aspects of the PHP interpreter. PHPBench can be used to compare hardware, operating systems, PHP versions, PHP accelerators and caches, compiler options, etc.

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.

Methodology

For BASELINE CPU we chose Intel Xeon E5-2640

  • It's a 6c/12t processor with a base clock 2.5GHz. This is close to average speeds that people will get with basic shared or VPS hostings.
  • Its turbo frequency (3.0GHz) is decent, but clearly below higher tier and workstation CPUs (3.5GHz-5GHz) which allows us to more easily show the distinction between good and great options.
  • This model came out 2012 and that also serves to display CPU family architecture improvemenets over the years.
  • We use it in 2 dual socket servers in bare-metal and containerized scenarios for dev and light-load usage cases. In 2020 it is still a solid and well balanced CPU that seems decent for most tasks in a webhosting environment.

Notes

  • PHPBench scores are mostly taken from Phoronix OpenBenchmark PHP Bench results. Some have been obtained during our own testing on in-house hardware.
  • Performance on bare-metal and in a virtual environment (LXC containers, KVM, HyperV) can difer quite a bit. Unless specified differently the scores are based on bare-metal benchmark. That is why we'll in future also publish a comparison analysis as they both provide valuable information:
    1. Bare-metal (displays raw CPU processing power)
    2. LXC/containers (more often a real-case usage).
  • A good practice is to perform benchmarks on an idle computer. As PHPBench test runs on a single CPU core (clearly visible from monitoring during the test) it means that it gets a result based on a CPUs single-core turbo frequency (basically the best case scenario). However, in real-life scenarios, esp. in shared environments, a webserver will be under at least some load and therefor never run idle. That means that PHP will most often be processed on a CPU core running much closer to base than turbo frequency.
  • For consistency sake we try to use scores without Intel CPU mitigations (e.g Spectre and Meltdown) though we've noticed that mitigations turned on did have an impact on many benchmarks.
LEGEND

  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


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?

The main reason why you can not easily fix your slow PHP webpage (Wordpress, WooCommerce, Magento...) by investing in a pricier webshosting with an i9-9900K is the fact that i9 platform does not support ECC memory. That opens up a couple of considerations.
  1. 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.
  2. 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.
  3. 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.)
  4. 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.
  5. 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?

  1. Best CPU for PHP with ECC would be an Intel Xeon E-2278G or E-2288G.
  2. 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 


 
Toast message
Toast-Top message