Skip to content

Instantly share code, notes, and snippets.

@yura
Created November 16, 2011 08:19
Show Gist options
  • Save yura/1369564 to your computer and use it in GitHub Desktop.
Save yura/1369564 to your computer and use it in GitHub Desktop.
# Тест из видео Ильи Григорика http://www.igvita.com/2010/06/07/rails-performance-needs-an-overhaul/
require 'rubygems'
require 'active_record'
ActiveRecord::Base.establish_connection(
:adapter => :mysql,
:database => 'mysql',
:username => 'root',
:password => '',
:pool => 5
)
threads = []
10.times do |n|
threads << Thread.new {
ActiveRecord::Base.connection_pool.with_connection do |conn|
res = conn.execute('select sleep(1)')
end
}
end
threads.each { |t| t.join }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment