-
-
Save trptcolin/2155418 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
#!/usr/bin/env ruby | |
require 'thread' | |
require 'rubygems' | |
require 'typhoeus' | |
mutex = Mutex.new | |
100000.times do |t| | |
Thread.new do | |
puts "requesting - #{t}" | |
req = Typhoeus::Request.new("http://#{ARGV[0]}:#{ARGV[1]}", | |
:method => :post, | |
:body => "something=somethingelse") | |
# this is still problematic: see all the shared state in | |
# https://github.com/dbalatero/typhoeus/blob/master/lib/typhoeus/hydra.rb | |
Typhoeus::Hydra.hydra.queue req | |
mutex.synchronize do | |
Typhoeus::Hydra.hydra.run | |
end | |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'sinatra' | |
post '/' do | |
"hello there!" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment