Last active
August 29, 2015 14:23
-
-
Save jpmoral/1765e88f6dc526397660 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra/base' | |
class GetServer < Sinatra::Base | |
set :logging, nil | |
get '/' do | |
puts "count: #{params["request_number"]}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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