Sha256: c9a2cadb36217fb740c6264fba5e14c0722b0f52ce4a775a525e37a9dea05714
Contents?: true
Size: 853 Bytes
Versions: 4
Compression:
Stored size: 853 Bytes
Contents
#!/usr/bin/env ruby require "rubygems" require "#{File.dirname(__FILE__)}/../lib/pigato.rb" #require "pigato" require 'thread' def start ts = [] (0..5).each do |tid| ts << Thread.new { client = Pigato::Client.new('tcp://127.0.0.1:55555', { :autostart => true, :timeout => 20000 }) requests = 50000 success = 0 d1 = Time.now requests.times do |i| begin sw = "Hello world #{i}" res = client.request('echo', sw) if res == sw success += 1 else puts "nil reply" end end end d2 = Time.now puts "#{success}/#{requests} requests/replies processed (#{(d2 - d1) * 1000} milliseconds)" } end ts.each do |to| to.join end end (0..2).each do |pid| pid = fork do start end end Process.waitall
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
pigato-0.4.9 | examples/echo_client.rb |
pigato-0.4.8 | examples/echo_client.rb |
pigato-0.4.7 | examples/echo_client.rb |
pigato-0.4.6 | examples/echo_client.rb |