Skip to content

Instantly share code, notes, and snippets.

@jpmoral jpmoral/server.rb
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.