Skip to content

Instantly share code, notes, and snippets.

@erikh
Created June 26, 2012 22:52
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 erikh/4f36f8543ad702861096 to your computer and use it in GitHub Desktop.
Save erikh/4f36f8543ad702861096 to your computer and use it in GitHub Desktop.
require 'socket'
threads = []
(0..ARGV[0].to_i).each do |i|
if i % 500 == 0
puts "#{i} threads spawned"
end
threads.push(
Thread.new do
t = TCPSocket.new("test", 11211)
$/ = "\r\n"
t.puts "stats"
while t.readline != "END\r\n"
1
end
sleep
end
)
end
threads.map(&:join)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment