lcurl Is a Script to Visit a Site Every X Seconds Using curl
This could be handy to use while testing your deployment strategy to make sure you're able to perform zero downtime deploys.
While testing a new deployment strategy I wanted to make sure one of my web apps continued to return 200s while I was performing a rolling update in a Kubernetes cluster so I decided to create a little script that wraps curl.
It’s available at: https://github.com/nickjj/lcurl
Here’s an example of visiting https://example.com every 250ms for a max of 5 times:
lcurl https://example.com 0.25 5
Running the above command will produce this output:
200 | 0.069927s | 2021-12-11T08:47:00 | 1/5
200 | 0.063947s | 2021-12-11T08:47:00 | 2/5
200 | 0.060945s | 2021-12-11T08:47:01 | 3/5
200 | 0.068982s | 2021-12-11T08:47:01 | 4/5
200 | 0.066179s | 2021-12-11T08:47:01 | 5/5
The video below walks through the origin of the script, using it and also goes over how the script was created. It’s a pretty basic Bash script that uses curl under the hood.
# Demo Video
Timestamps
- 0:17 – Going over what the script does
- 0:47 – I used this script to help test performing a zero downtime deploy
- 2:07 – A specific Kubernetes issue I came across with the AWS Load Balancer Controller
- 3:25 – Demonstrating the script on the command line
- 4:42 – This script is made for quickly monitoring HTTP status codes, not benchmarking
- 5:08 – Going over the script’s implementation details
- 8:07 – curl is the hero of this story
- 10:53 – Installing the lcurl script
- 12:11 – Briefly going over the FAQ in the README file
Reference Links
- https://kubernetes-sigs.github.io/aws-load-balancer-controller
- https://github.com/wg/wrk
- https://everything.curl.dev/usingcurl/verbose/writeout#available-write-out-variables
- https://github.com/nickjj/dotfiles/commit/42a3c5bae24575d9324b10b2f83587a995840289
What are you going to use this script for? Let me know below.