DO Hackathon: Deployment Benchmark
Tags: dohackathon
Published: 2021-01-09 19:59:39

Nobody likes waiting for a website to load, so it's important to have performance in mind while hosting websites.

In this article, I will compare the performance of both the deployment methods from the previous article in this series.

## Benchmark Methodology
I'll be focusing exclusively on latency as that's what the end-user cares about. I'll be running an [http benchmark tool](https://github.com/tsenart/vegeta) from DigitalOcean droplets located in Toronto 1 and in Frankfurt 1, running these scripts:
```bash
# Kubernetes deployment
echo "GET https://krasnov.dev" | vegeta attack -duration=60s | vegeta report

# App Platform deployment
echo "GET https://denniskrasnov.com" | vegeta attack -duration=60s | vegeta report
```

## The Results

#### Toronto 1 -> Kubernetes (Toronto 1)
Note that both resources are in the same region.
```
Requests      [total, rate, throughput]         3000, 50.02, 50.01
Duration      [total, attack, wait]             59.983s, 59.98s, 2.885ms
Latencies     [min, mean, 50, 90, 95, 99, max]  1.715ms, 3.944ms, 2.485ms, 3.147ms, 5.321ms, 50.502ms, 144.859ms
Bytes In      [total, mean]                     6348000, 2116.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000
```

#### Toronto 1 -> App Platform
```
Requests      [total, rate, throughput]         3000, 50.02, 50.01
Duration      [total, attack, wait]             59.986s, 59.98s, 5.764ms
Latencies     [min, mean, 50, 90, 95, 99, max]  5.141ms, 9.251ms, 7.443ms, 13.194ms, 17.124ms, 30.828ms, 223.472ms
Bytes In      [total, mean]                     40320000, 13440.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000
```

#### Frankfurt 1 -> Kubernetes (Toronto 1)
This represents a user that lives far away.
```
Requests      [total, rate, throughput]         3000, 50.02, 49.94
Duration      [total, attack, wait]             1m0s, 59.98s, 96.21ms
Latencies     [min, mean, 50, 90, 95, 99, max]  95.502ms, 103.55ms, 96.419ms, 98.411ms, 103.918ms, 344.845ms, 616.864ms
Bytes In      [total, mean]                     6348000, 2116.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000
```

#### Frankfurt 1 -> App Platform
```
Requests      [total, rate, throughput]         3000, 50.02, 50.01
Duration      [total, attack, wait]             59.986s, 59.98s, 6.333ms
Latencies     [min, mean, 50, 90, 95, 99, max]  4.248ms, 9.539ms, 6.037ms, 9.089ms, 11.87ms, 62.803ms, 666.033ms
Bytes In      [total, mean]                     40320000, 13440.00
Bytes Out     [total, mean]                     0, 0.00
Success       [ratio]                           100.00%
Status Codes  [code:count]                      200:3000
```

#### Mean latencies from all runs
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0c13vp226zr06dw3wuyf.png)

## Kubernetes
Kubernetes clusters are designed to be hosted in one location. This works well locally, but is slower when users are far away.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/45ysd8krx1ftmgzman7s.png)

## App Platform
Hosting on App Platform is geographically distributed (thanks to the built in CDN), and is performant no matter where the users are located.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iwwszlothnxwwpgwawia.png)

## Conclusion
For static websites, hosting on Digital App Platform can be more performant for users far away.