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

Version Path
polyphony-1.6 examples/adapters/sequel_mysql_pool.rb
polyphony-1.5 examples/adapters/sequel_mysql_pool.rb
polyphony-1.4 examples/adapters/sequel_mysql_pool.rb
polyphony-1.3 examples/adapters/sequel_mysql_pool.rb
polyphony-1.2.1 examples/adapters/sequel_mysql_pool.rb
polyphony-1.2 examples/adapters/sequel_mysql_pool.rb
polyphony-1.1.1 examples/adapters/sequel_mysql_pool.rb
polyphony-1.1 examples/adapters/sequel_mysql_pool.rb
polyphony-1.0.2 examples/adapters/sequel_mysql_pool.rb
polyphony-1.0.1 examples/adapters/sequel_mysql_pool.rb
polyphony-1.0 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.6 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.5 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.4 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.3 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.2 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99.1 examples/adapters/sequel_mysql_pool.rb
polyphony-0.99 examples/adapters/sequel_mysql_pool.rb
polyphony-0.98 examples/adapters/sequel_mysql_pool.rb
polyphony-0.97 examples/adapters/sequel_mysql_pool.rb