Sha256: 193b42fab2bcf37968fcaf8e50e821ad6d35794a51f6b4f6209d77db9c0f0de5

Contents?: true

Size: 670 Bytes

Versions: 3

Compression:

Stored size: 670 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 })

      requests = 1000
      d1 = Time.now
      requests.times do |i|
        begin
          client.request('echo', 'Hello world1')
        end
      end
      d2 = Time.now
      puts "#{requests} requests/replies processed (#{(d2 - d1) * 1000} milliseconds)"
    }
  end

  ts.each do |to|
    to.join
  end
end

(0..1).each do |pid|
  pid = fork do
    start
  end
end

Process.waitall

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pigato-0.4.3 examples/echo_client.rb
pigato-0.4.2 examples/echo_client.rb
pigato-0.4.1 examples/echo_client.rb