Skip to content

Test of ActiveRecord connections in a multithreaded case

Notifications You must be signed in to change notification settings

dangerouse/mtar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mtar

Test of ActiveRecord connections in a multithreaded case

On my computer, running jruby-1.7.2

Happy case:

mtarcon $ env wait=1 close=1 threads=300 bundle exec ruby run.rb

Testing with 300 threads using `connection.close`. 1 connections in the pool, 1 second wait time.
............................................................................................................................................................................................................................................................................................................

Elapsed real time: 2.026 seconds

Failing case

mtarcon $ env wait=1 close=0 threads=5 bundle exec ruby run.rb

Testing with 5 threads not using `connection.close`. 1 connections in the pool, 1 second wait time.
.DEPRECATION WARNING: Database connections will not be closed automatically, please close your
database connection at the end of the thread by calling `close` on your
connection.  For example: ActiveRecord::Base.connection.close
. (called from mon_synchronize at /Users/graemerouse/.rvm/rubies/jruby-1.7.2/lib/ruby/1.9/monitor.rb:211)
Exception in thread thread 0: ActiveRecord::ConnectionTimeoutError
.Exception in thread thread 3: ActiveRecord::ConnectionTimeoutError
Exception in thread thread 4: ActiveRecord::ConnectionTimeoutError


Elapsed real time: 1.573 seconds

About

Test of ActiveRecord connections in a multithreaded case

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages