Magento 2.3 performance on different AWS instances C5 vs Z1

Can CPU clock speed improve PHP Magento 2 performance

C5 instance

Amazon EC2 C5 instances are the next generation of the Amazon EC2 Compute Optimized instance family. C5 instances offer the lowest price per vCPU in the Amazon EC2 family and are ideal for running advanced compute-intensive workloads. This includes workloads such as high performance web servers, high-performance computing (HPC), batch processing, ad serving, highly scalable multiplayer gaming, video encoding, scientific modelling, distributed analytics and machine/deep learning inference.

C5.large — 61$/month

3.0 Ghz Intel Xeon Platinum 8124M

2 vCPU

4 GiB memory

EBS only

Upto 2250 Mbps EBS throughput

Up to 10 Gigabit networking performance

Z1 instance

Amazon EC2 z1d instances deliver high single thread performance due to a custom Intel® Xeon® Scalable processor with a sustained all core frequency of up to 4.0 GHz, the fastest of any cloud instance. z1d provides both high compute performance and high memory, which is ideal for electronic design automation (EDA), gaming, and certain relational database workloads with high per-core licensing costs.

Z1s.large — 151$/month

4.0 GHz Intel Xeon Platinum 8151

2 vCPU

16 GiB memory

1 x 75 NVMe SSD

Up to 10 Gigabit networking performance

Performance measurement 50 samples concurrency 1

Why CPU?

Because Magento 2 is PHP CPU intensive framework (5M lines of code).

Ratio between PHP and Database(MySQL/Redis IO)

Database = 194ms+48ms =242ms

PHP time = 906ms

Response time = 906+242 = 1148ms

906PHP/1148Request = 78.92% of the request is CPU time.

242Database/1148Request =21.08% of the request is I/O Database time.

databaseDuration = Total time of all database calls for any functions we instrument as Database functions. So MySQL/PDO/PostgreSQL/Redis/Memcache type calls that are instrumented and appear in New Relic.

PHP Time = total response time — (databaseDuration) — This is a calculated factor that if our instrumented external calls and database calls. Time spent in PHP code that wasn’t external calls or database calls.

1.Home page speed.


Result: 110ms


Result: 104ms

2.Configurable product




Result: 271ms

3.Configurable products


Result: 394ms


Result: 347ms

4.Section AJAX load


Result: 92ms


Result: 85ms

5.FPC performance


Result: 66 ms


Result: 66ms

FPC speed average result is the same 66ms however max delay is 104ms vs 86 ms

6.Add To CART


Result: 316


Result: 291

Pivot Table:

Basically, by buying faster CPU you can achieve better performance. I’m considering GPU processors will be the best for Magneto. However run Magento on fast CPU is 2 times expansive 61$ vs 151$ per 2 vCPU.

Written by

Magento/APP Cloud Architect. Melting metal server infrastructure into cloud solutions.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store