Optimizing My $5 of Proxy
In my last post, I paid five dollars for 5GB of residential proxy bandwidth to get InstaPlayer working again. Five dollars is not a lot of money, but 5GB is not a lot of bandwidth either, especially for an app that downloads songs that are 30 to 50MB each.
If I sent the songs through the proxy, my five dollars would disappear after around one hundred songs, which is around two of my typical playlists. As the broke college student I am, that isn’t quite sustainable.
Optimizing download traffic
Luckily, the songs do not need to strictly be routed through the proxy. Only the Cloudflare Captcha cares about the IP address. So, I route the Captcha’s token through the proxy and route everything else through my server’s normal datacenter IP.
Solving one challenge uses roughly 75KB of proxy bandwidth, and the session lasts for about six hours. That means I need at most four new sessions per day.
5GB / 75KB = about 66,000 sessions
66,000 sessions / 4 per day = ~45 years
The bandwith I bought doesn’t expire, so theoretically, with this $5, I am set to download however much music I want.
What I learned
This is probably the first time an architecture decision has saved me real money. It is exciting to say the least to make these kinds of decisions. I’m looking forward to working on bigger systems and saving bigger money some time later in my career.