[LRUG] Downloading images quickly

Andrew Stewart boss at airbladesoftware.com
Tue Feb 5 03:54:10 PST 2013


On 5 Feb 2013, at 12:13, Tom Stuart wrote:
> Typhoeus uses non-blocking I/O to perform simultaneous requests — it's still single-threaded, like EventMachine. If you sleep the (only) interpreter thread 40 times, you'll wait 120 seconds regardless of any I/O you're doing.

Aha!

> If you want to test it for real, you'll need to arrange for each HTTP request to actually take 3 seconds to return. Maybe write a little Rack app that sleeps for 3 seconds before responding, run it locally in a multithreaded application server (e.g. Puma), and point your code at that instead of S3?

I did exactly this and downloaded the 40 images in ~9s, as hoped (with Puma's default 16 threads).

Thanks!

Cheers,
Andy


More information about the Chat mailing list