Magento Cloud RipCurl Performance  
Tags: magento, php, webdev
Published: 2020-10-29 10:03:08

I just read news about  Magento 2 implementation of the RipCurl eCommerce website. It is always nice to check modern and fast e-commerce technologies at work. I just finished my K6 performance test toll optimized for Magento 2 performance testing. All Merchants on M2 struggle with different kinds of performance problems, especially during high load periods - Black Friday, Christmas, successful promotions, or just successful business.

# Product Generation Page Performance:

## Concurrency 1 virtual user:
```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  

running (00m23.1s), 0/1 VUs, 10 complete and 0 interrupted iterations
default ✓ [======================================] 1 VUs  00m23.0s/10m0s  10/10 shared iters

    █ setup

    █ teardown

    data_received..............: 3.2 MB 138 kB/s
    data_sent..................: 17 kB  749 B/s
    http_req_blocked...........: min=1.45µs   med=1.53µs   avg=6.93ms   max=69.33ms  p(95)=38.13ms 
    http_req_connecting........: min=0s       med=0s       avg=685.27µs max=6.85ms   p(95)=3.76ms  
    http_req_duration..........: min=1.7s     med=2.36s    avg=2.29s    max=3.19s    p(95)=2.92s   
    http_req_receiving.........: min=10.59ms  med=12.72ms  avg=15.6ms   max=33.44ms  p(95)=28.97ms 
    http_req_sending...........: min=65.68µs  med=102.94µs avg=136.96µs max=443.34µs p(95)=301.94µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=2.14ms   max=21.49ms  p(95)=11.82ms 
    http_req_waiting...........: min=1.68s    med=2.35s    avg=2.27s    max=3.18s    p(95)=2.91s   
    http_reqs..................: 10     0.433584/s
    iteration_duration.........: min=339.13µs med=2.33s    avg=1.91s    max=3.19s    p(95)=2.86s   
    iterations.................: 10     0.433584/s
    vus........................: 1      min=1 max=1
    vus_max....................: 1      min=1 max=1
```
Percentile 95: 2.91s Time To First Bite 

A 95th percentile is a number that is greater than 95% of the numbers in a given set. This statistic is so useful in measuring data throughput that it gives a very accurate picture of the maximum TTFB. This is a standard measure used in interpreting performance data.

## Concurrency 5 virtual users:

```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  source=console

running (00m11.3s), 0/5 VUs, 20 complete and 0 interrupted iterations
default ✓ [======================================] 5 VUs  00m11.1s/10m0s  20/20 shared iters

    █ setup

    █ teardown

    data_received..............: 6.4 MB 568 kB/s
    data_sent..................: 37 kB  3.3 kB/s
    http_req_blocked...........: min=1.14µs   med=1.56µs   avg=13.66ms  max=58.18ms  p(95)=55.97ms 
    http_req_connecting........: min=0s       med=0s       avg=1.93ms   max=8.13ms   p(95)=7.98ms  
    http_req_duration..........: min=1.78s    med=2.59s    avg=2.56s    max=3.47s    p(95)=3.46s   
    http_req_receiving.........: min=4.19ms   med=23.81ms  avg=27.68ms  max=61.94ms  p(95)=61.73ms 
    http_req_sending...........: min=58.12µs  med=105.07µs avg=203.09µs max=657.13µs p(95)=645.37µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=6.32ms   max=28.62ms  p(95)=26.58ms 
    http_req_waiting...........: min=1.77s    med=2.54s    avg=2.54s    max=3.44s    p(95)=3.43s   
    http_reqs..................: 20     1.776289/s
    iteration_duration.........: min=380.98µs med=2.59s    avg=2.34s    max=3.47s    p(95)=3.43s   
    iterations.................: 20     1.776289/s
    vus........................: 2      min=2 max=5
    vus_max....................: 5      min=5 max=5

```
95 Percentile: 3.43s

## Concurrency 10 virtual users
```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  source=console

running (00m15.1s), 00/10 VUs, 50 complete and 0 interrupted iterations
default ✓ [======================================] 10 VUs  00m15.0s/10m0s  50/50 shared iters

    █ setup

    █ teardown

    data_received..............: 16 MB 1.1 MB/s
    data_sent..................: 92 kB 6.1 kB/s
    http_req_blocked...........: min=1.18µs   med=1.61µs   avg=9.24ms   max=50.56ms  p(95)=47.47ms 
    http_req_connecting........: min=0s       med=0s       avg=1.59ms   max=9.42ms   p(95)=8.14ms  
    http_req_duration..........: min=1.71s    med=2.64s    avg=2.76s    max=4.6s     p(95)=4.13s   
    http_req_receiving.........: min=6.23ms   med=19.26ms  avg=32.93ms  max=105.22ms p(95)=94.3ms  
    http_req_sending...........: min=61.86µs  med=107.29µs avg=155.36µs max=469.79µs p(95)=372.43µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=5.36ms   max=29.32ms  p(95)=28.28ms 
    http_req_waiting...........: min=1.69s    med=2.62s    avg=2.73s    max=4.59s    p(95)=4.12s   
    http_reqs..................: 50    3.316503/s
    iteration_duration.........: min=382.42µs med=2.63s    avg=2.67s    max=4.6s     p(95)=4.11s   
    iterations.................: 50    3.316503/s
    vus........................: 1     min=1  max=10
    vus_max....................: 10    min=10 max=10
```
  Result: 4.12 

Pretty good result as for Magento Cloud. 10 requests it can handle. 

How about 20?

## 20 virtual users:

```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  source=console

running (00m30.4s), 00/20 VUs, 200 complete and 0 interrupted iterations
default ✓ [======================================] 20 VUs  00m30.3s/10m0s  200/200 shared iters

    █ setup

    █ teardown

    data_received..............: 64 MB  2.1 MB/s
    data_sent..................: 354 kB 12 kB/s
    http_req_blocked...........: min=1.12µs   med=1.56µs   avg=7.64ms   max=79.51ms  p(95)=76.35ms 
    http_req_connecting........: min=0s       med=0s       avg=826.44µs max=9.21ms   p(95)=8.35ms  
    http_req_duration..........: min=1.73s    med=2.69s    avg=2.87s    max=5.57s    p(95)=4.17s   
    http_req_receiving.........: min=6.19ms   med=15.77ms  avg=29.89ms  max=301.49ms p(95)=117.4ms 
    http_req_sending...........: min=51.65µs  med=102.85µs avg=131µs    max=473.27µs p(95)=362.23µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=3.63ms   max=38.36ms  p(95)=36.27ms 
    http_req_waiting...........: min=1.72s    med=2.66s    avg=2.84s    max=5.56s    p(95)=4.15s   
    http_reqs..................: 200    6.583933/s
    iteration_duration.........: min=355.88µs med=2.69s    avg=2.85s    max=5.57s    p(95)=4.17s   
    iterations.................: 200    6.583933/s
    vus........................: 2      min=2  max=20
    vus_max....................: 20     min=20 max=20
```
Result: 4.15s

## 40 users:

```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  source=console

running (00m19.3s), 00/40 VUs, 200 complete and 0 interrupted iterations
default ✓ [======================================] 40 VUs  00m19.2s/10m0s  200/200 shared iters

    █ setup

    █ teardown

    data_received..............: 64 MB  3.3 MB/s
    data_sent..................: 367 kB 19 kB/s
    http_req_blocked...........: min=1.02µs   med=1.67µs   avg=18.85ms  max=98.43ms  p(95)=95.81ms 
    http_req_connecting........: min=0s       med=0s       avg=1.9ms    max=14.25ms  p(95)=10.58ms 
    http_req_duration..........: min=1.8s     med=3.21s    avg=3.38s    max=6.08s    p(95)=5.03s   
    http_req_receiving.........: min=6.15ms   med=27.13ms  avg=53.49ms  max=257.33ms p(95)=215.17ms
    http_req_sending...........: min=54.34µs  med=112.01µs avg=157.51µs max=1ms      p(95)=356.92µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=13.14ms  max=68.54ms  p(95)=66.12ms 
    http_req_waiting...........: min=1.68s    med=3.19s    avg=3.33s    max=6.03s    p(95)=5.01s   
    http_reqs..................: 200    10.352761/s
    iteration_duration.........: min=394.04µs med=3.2s     avg=3.37s    max=6.08s    p(95)=5.02s   
    iterations.................: 200    10.352761/s
    vus........................: 2      min=2  max=40
    vus_max....................: 40     min=40 max=40
```

Result: 5.01

## 60 Users

```
Tested URL: https://www.ripcurl.com/us/womens/swimwear/one-pieces-sets/classic-surf-eco-one-piece.html  source=console

running (00m23.2s), 00/60 VUs, 300 complete and 0 interrupted iterations
default ✓ [======================================] 60 VUs  00m23.1s/10m0s  300/300 shared iters

    █ setup

    █ teardown

    data_received..............: 96 MB  4.1 MB/s
    data_sent..................: 552 kB 24 kB/s
    http_req_blocked...........: min=1.02µs   med=1.69µs   avg=24.9ms   max=131.3ms  p(95)=128.17ms
    http_req_connecting........: min=0s       med=0s       avg=2.24ms   max=20.39ms  p(95)=15.63ms 
    http_req_duration..........: min=1.84s    med=3.6s     avg=4.12s    max=8.33s    p(95)=7.2s    
    http_req_receiving.........: min=9.07ms   med=30.88ms  avg=50.82ms  max=333.82ms p(95)=149.26ms
    http_req_sending...........: min=54.62µs  med=110.04µs avg=154.05µs max=441.15µs p(95)=377.79µs
    http_req_tls_handshaking...: min=0s       med=0s       avg=18.74ms  max=99.05ms  p(95)=96.31ms 
    http_req_waiting...........: min=1.7s     med=3.5s     avg=4.06s    max=8.31s    p(95)=7.17s   
    http_reqs..................: 300    12.922481/s
    iteration_duration.........: min=325.56µs med=3.7s     avg=4.11s    max=8.33s    p(95)=7.2s 
```
Result: 7s 

Throughput is not bad however, TTFB performance is relay slow 2.5. Moving out from the Magento cloud usually speeds up TTFB 2-3 times. Sub-second TTFB without FPC possible if to use AWS Graviton 2 processor. 

However, performance is more than the initial load time. That initial load time or time to the first byte typically accounts for less than 5%-10% of your time to the first interaction, a more meaningful performance metric.

The 90-95% after the initial content is loaded due to poor front-end architecture. And even Varnish will not help you. 

## Frontend Performance 

## Google Page Speed Insight Mobile: 
** SummaryOver ** the previous 28-day collection period, the aggregate experience of all pages served from this origin does not pass the Core Web Vitals assessment. To view suggestions tailored to each page, analyze individual page URLs.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7wvpx6m20t4tbvn4qreo.jpg)

First Contentful Paint: 18.8 s
Speed Index: 29.6 s
Largest Contentful Paint: 34.8 s
Time to Interactive: 49.2 s
Total Blocking Time: 11,240 ms
Cumulative Layout Shift: 0

# Magento 2 Page Loading Visualisation 

{% youtube PlKiLTB4nME %}

## Desktop 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6s6zteoq7nq0f6j1mss3.jpg)

First Contentful Paint: 3.6 s
Speed Index: 6.7 s
Largest Contentful Paint: 7.0 s
Time to Interactive: 8.7 s
Total Blocking Time: 1,030 ms
Cumulative Layout Shift: 0

# Content Breakdown by MIME type:

![Magento 2 Content Breakdown](https://dev-to-uploads.s3.amazonaws.com/i/9rl1yp9yikc424g5x404.jpg)

The main issue here is broken Magento JS bundling - 1 file - 3+ MB to download - 15 MB JS code to execute. 

The King James Version of the Bible Plain Text is 4.3 MB. Browser uploading, compiling, and executing 4 Biles per page load. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qbkuyowh6k5efjamjuxb.jpg)

# Rip Curl real user experience historical data provided by Google

## Time To First Byte

![CRUIX TTFB](https://dev-to-uploads.s3.amazonaws.com/i/tyylbzal3b3b4pmnjiuk.png)

## First Contentful Paint (FCP)

![FCP](https://dev-to-uploads.s3.amazonaws.com/i/yf9j72lj56hfju8h5sfc.png)

We can see 95% of the visitors have an unsatisfied user experience after migration to the M2.

Bad Magento 2 performance also affects the ecological impact of the Rip Curl website on our environment:

Over a year, with 100,000 monthly page, views,ripcurl.com/us produces 4,940kg of CO2 equivalent.

The same weight as 30.29 sumo wrestlers and as much CO2 as boiling water for 669,380 cups of tea.

This web page emits the amount of carbon that 230 trees absorb in a year.

This Magento 2 website consumes 10,400kWh of energy.
That’s enough electricity to drive an electric car 66,560 km.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/r7rk7lgjjico8tu6cfd2.jpg)

CO2 Data source: https://www.websitecarbon.com/website/ripcurl-com-us/