Magento 2.3 performance on different AWS instances C5 vs Z1

Can CPU clock speed improve PHP Magento 2 performance

Yegor Shytikov
4 min readMar 17, 2020

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.

C5

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 37 4.5 36 66
Processing: 321 348 22.5 345 471
Waiting: 104 113 9.4 110 141
Total: 357 386 24.3 382 507

Result: 110ms

Z1d

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 37 3.7 36 56
Processing: 201 346 33.8 338 442
Waiting: 99 109 13.4 104 178
Total: 240 383 33.8 378 479

Result: 104ms

2.Configurable product

C5

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 37 2.1 37 45
Processing: 464 496 29.4 490 622
Waiting: 281 309 29.3 301 428
Total: 500 533 29.2 529 658

Result:301

Z1d

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 38 3.2 36 48
Processing: 477 516 27.2 507 598
Waiting: 251 272 16.5 271 342
Total: 512 553 26.9 546 633

Result: 271ms

3.Configurable products

C5

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 41 13.2 37 105
Processing: 767 864 128.2 813 1436
Waiting: 366 414 92.5 394 1027
Total: 802 905 130.7 851 1476

Result: 394ms

Z1d

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 38 4.3 37 56
Processing: 530 768 65.8 759 1058
Waiting: 325 351 21.7 347 422
Total: 566 807 66.2 797 1096

Result: 347ms

4.Section AJAX load

C5

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 39 5.6 37 69
Processing: 86 95 9.9 93 141
Waiting: 86 95 9.8 92 141
Total: 122 134 12.8 130 192

Result: 92ms

Z1d

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 39 5.1 37 61
Processing: 81 87 7.8 85 126
Waiting: 81 87 7.8 85 126
Total: 117 125 10.9 122 187

Result: 85ms

5.FPC performance

C5

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 41 6.3 39 58
Processing: 290 333 63.5 317 729
Waiting: 60 69 9.5 66 104
Total: 325 374 64.0 361 765

Result: 66 ms

Z1d

Connection Times (ms)
min mean[+/-sd] median max
Connect: 35 40 7.3 37 74
Processing: 288 325 21.8 323 372
Waiting: 62 69 6.9 66 86
Total: 323 366 23.7 363 414

Result: 66ms

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

6.Add To CART

C5

Result: 316

Z1d

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.

--

--

Yegor Shytikov
Yegor Shytikov

Written by Yegor Shytikov

True Stories about Magento 2. Melting down metal server infrastructure into cloud solutions.

No responses yet