Skip to content

Instantly share code, notes, and snippets.

@lccxx
Last active February 22, 2020 11:05
Show Gist options
  • Save lccxx/89c61458d0e5b9a8d2d3b857b10db032 to your computer and use it in GitHub Desktop.
Save lccxx/89c61458d0e5b9a8d2d3b857b10db032 to your computer and use it in GitHub Desktop.
require "http/client"
sum = 0
100.times {
spawn {
10000.times {
HTTP::Client.get("http://127.0.0.1/") { |res| sum += 1 }
}
}
}
old_sum = sum
loop {
sleep 1
per_second = sum - old_sum
break if per_second == 0
puts "per second: #{per_second}, sum: #{sum}"
old_sum = sum
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment