Created
April 11, 2014 15:06
-
-
Save maxdemarzi/10476334 to your computer and use it in GitHub Desktop.
Can't get more than 6000 r/s
This file contains hidden or 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 '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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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