Skip to content

Instantly share code, notes, and snippets.

@pimeys
Created July 10, 2012 14:47
Show Gist options
  • Save pimeys/3083742 to your computer and use it in GitHub Desktop.
Save pimeys/3083742 to your computer and use it in GitHub Desktop.
pinger
require 'net/http'
require 'uri'
GC.disable
threads = 100.times.map do
Thread.new do
10.times do
uri = URI.parse('http://example.com')
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
start_time = Time.now
response = http.request(request)
puts "fetch in #{((Time.now - start_time) * 1000)} ms, GC.count is #{GC.count}"
end
end
end
threads.each(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment