Skip to content

Instantly share code, notes, and snippets.

@jpmoral
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpmoral/1765e88f6dc526397660 to your computer and use it in GitHub Desktop.
Save jpmoral/1765e88f6dc526397660 to your computer and use it in GitHub Desktop.
require 'sinatra/base'
class GetServer < Sinatra::Base
set :logging, nil
get '/' do
puts "count: #{params["request_number"]}"
end
end
require 'typhoeus'
require 'net/http'
ATTEMPTS = 300_000
hydra = Typhoeus::Hydra.new
ATTEMPTS.times do |i|
request = Typhoeus::Request.new(
'127.0.0.1:4567',
method: :get,
params: { request_number: i },
connecttimeout: 5,
timeout: 5
)
request.on_complete do |r|
if r.timed_out?
puts "#{i} timed out at #{Time.now}"
end
end
hydra.queue request
end
hydra.run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment