Skip to content

Instantly share code, notes, and snippets.

@maxdemarzi
Created April 11, 2014 15:06
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 maxdemarzi/10476334 to your computer and use it in GitHub Desktop.
Save maxdemarzi/10476334 to your computer and use it in GitHub Desktop.
Can't get more than 6000 r/s
require 'net/http/pipeline'
def runit
Net::HTTP.start 'localhost', 7474 do |http|
http.pipelining = true
reqs = []
6000.times do
reqs << Net::HTTP::Get.new('/')
end
count = 0
http.pipeline reqs do |res|
count+= 1 if (res.code == "200")
end
puts count
end
end
puts "Started At #{Time.now}"
start = Time.now
count = 0
arr = []
10.times do |i|
arr[i] = Thread.new {
runit
count += 1
}
end
arr.each {|t| t.join; }
puts "count = #{count}"
puts "End at #{Time.now}"
p Time.now - start
@maxdemarzi
Copy link
Author

gem install net-http-pipeline

@maxdemarzi
Copy link
Author

Started At 2014-04-11 10:05:44 -0500
6000
6000
6000
6000
6000
6000
6000
6000
6000
6000
count = 10
End at 2014-04-11 10:05:55 -0500
10.861858

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment