Quickly Test Slow Uploads
I had to deal with an issue on a small, old project today that’s hosted on Heroku: large file uploads were causing Heroku’s 30-second timeout to cancel the request.
Heroku recommends using the Puma web server, as it can handle slow clients better.
This was a perfect, quick solution to my problem. I updated my Gemfile
and Procfile
for Puma, and deployed.
But how do I test this? I could generate a giant file, but our connection is fast, and that sounds boring. Let’s take a normal file and make it go slowly.
I’ve written before about Network Link Conditioner and it will do exactly what I want to do here.
I simply fire up Network Link Conditioner and change it to be a very slow, lossy connection. Then I uploaded a normal size file and let it upload for a while (about a minute, for fun). After that, I changed the network setting from “Edge, Lossy Network” to a faster one like “3G, Average Case” and let the request finish.
That quickly proved that my change to Puma was effective.
Comments