Sha256: 7944ea3b727add23886d92e6eb5decc1d60e3a06977bfda52b00e0bce7db82ad
Contents?: true
Size: 618 Bytes
Versions: 92
Compression:
Stored size: 618 Bytes
Contents
# frozen_string_literal: true require 'bundler/setup' require 'polyphony/adapters/sequel' require 'polyphony/adapters/mysql2' CONCURRENCY = ARGV.first ? ARGV.first.to_i : 1000 puts "concurrency: #{CONCURRENCY}" db = Sequel.connect( 'mysql2://localhost/test', max_connections: 100, preconnect: true ) t0 = Time.now count = 0 fibers = Array.new(CONCURRENCY) do spin do loop do db.execute('select sleep(0.001) as test') count += 1 end end end sleep 0.1 fibers.first.terminate # Interrupt mid-query sleep 2 puts "query rate: #{count / (Time.now - t0)} reqs/s" fibers.each(&:interrupt)
Version data entries
92 entries across 92 versions & 1 rubygems