Skip to content

Instantly share code, notes, and snippets.

@anuragkapur
Last active May 16, 2024 01:52
Show Gist options
  • Save anuragkapur/0b341867c2d84678e372308f51d23f00 to your computer and use it in GitHub Desktop.
Save anuragkapur/0b341867c2d84678e372308f51d23f00 to your computer and use it in GitHub Desktop.
Fastly latency compared to AWS API gateway
################
# Test script
################
#!/bin/bash
echo "fastlyTime,awsGatewayTime" >> responsetimes.log
while true
do
fastlyTime=`curl -o /dev/null -s -w %{time_total} -H 'X-Api-Key: 8Glz7vn2pM47AzzKmrXDU82h3S0Iud9n7wDgp3wM' https://round-trippa.ft.com/callback`
sleep 1
awsGatewayTime=`curl -o /dev/null -s -w %{time_total} -H 'X-Api-Key: 8Glz7vn2pM47AzzKmrXDU82h3S0Iud9n7wDgp3wM' https://round-trippa-gw-eu-west-1-prod.memb.ft.com/callback`
sleep 1
echo "${fastlyTime},${awsGatewayTime}" >> responsetimes.log
done
###############
# Test host: 52.212.56.144 an EC2 instanace running in Dublin
###############
################
# MTR resport from test host to fastly
#$ sudo mtr -rw round-trippa.ft.com
#HOST: ip-172-31-41-3 Loss% Snt Last Avg Best Wrst StDev
# 1. ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
# 2. ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
# 3. ??? 100.0 10 0.0 0.0 0.0 0.0 0.0
# 4. 100.64.16.31 0.0% 10 0.4 0.9 0.4 5.0 1.5
# 5. 178.236.0.108 0.0% 10 0.9 1.0 0.8 1.8 0.3
# 6. 178.236.0.76 0.0% 10 0.9 1.0 0.9 1.1 0.1
# 7. 176.32.106.224 0.0% 10 9.8 9.8 9.8 9.9 0.0
# 8. 52.95.61.110 0.0% 10 19.7 16.2 12.2 21.0 3.2
# 9. 52.95.61.105 0.0% 10 9.8 9.9 9.8 10.0 0.1
# 10. 199.27.73.76 0.0% 10 9.7 9.8 9.7 9.9 0.0
# 11. 151.101.60.230 0.0% 10 9.7 9.8 9.7 9.8 0.0
################
################
# Summary stats from a 1 hour test
################
scala> df.select(avg($"fastlyTime"), avg($"awsGatewayTime")).show()
+-------------------+-------------------+
| avg(fastlyTime)|avg(awsGatewayTime)|
+-------------------+-------------------+
|0.21756380510440892| 0.1384137664346479|
+-------------------+-------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment