Last active
February 29, 2016 20:12
-
-
Save maxpospischil/7c82efc0e533e865c324 to your computer and use it in GitHub Desktop.
httpi_slowness
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' | |
require 'securerandom' | |
10.times do |i| | |
t0 = Time.now | |
uri = URI.parse("http://apple.com?rand=#{SecureRandom.hex}") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
res = http.request(request) | |
puts "call #{i}: #{Time.now-t0}" | |
end | |
10.times do |i| | |
t0 = Time.now | |
uri = URI.parse("http://google.com?rand=#{SecureRandom.hex}") | |
http = Net::HTTP.new(uri.host, uri.port) | |
request = Net::HTTP::Get.new(uri.request_uri) | |
res = http.request(request) | |
puts "call #{i}: #{Time.now-t0}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment