Skip to content

Instantly share code, notes, and snippets.

@trptcolin
Forked from blakesmith/test_script.rb
Created March 22, 2012 03:30
Show Gist options
  • Save trptcolin/2155418 to your computer and use it in GitHub Desktop.
Save trptcolin/2155418 to your computer and use it in GitHub Desktop.
#!/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
#!/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