I was running some load tests with the tool wrk and noticed some strange numbers after running multiple tests. I created the following test to show the problem I am seeing.
# file to serve
echo '{"message":"Yeah,it works"}' > test.txt
# run webserver
python3 -m http.server 8000 --bind 127.0.0.1
In another session I run the wrk tool
# run a test with 1 thread and 1 connection for 15 seconds
# brew install wrk ( is how I installed the tool )
#
wrk -t1 -c1 -d15s "http://127.0.0.1:8000/test.txt"
When I run wrk the first time I see about 16360 requests in the 15seconds. However, if I run the wrk command again a few times I will see the performance drop to ~2000 requests in 15seconds. I have tried this on two computers running difference versions of Python (3.8, 3.9, 3.10), all with the same results. If I keep running the wrk test I will see the numbers go back up the results were never consistent.
What is happening and why would I see the performance drop like this?