Project

General

Profile

Feature #10176

Document how to perform net/http calls in parallel

Added by mperham (Mike Perham) about 5 years ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:64592]

Description

The typhoeus gem is a big source of Ruby VM crashes. It seems to me that the only reason people use this gem is because net/http doesn't document how to GET many URLs in parallel. I'd like to see a simple code example in the net/http RDoc which show people how to fetch many URLs in parallel using net/http. For example, this might be one way but I don't know if it's the recommended or most efficient way:

urls = %w(www.yahoo.com www.google.com www.bing.com)
results = urls.map { |url| Thread.new { Net::HTTP.get(url, '/') } }.map(&:join)

Also available in: Atom PDF