From: "Michael Koziarski" <mich...@koziarski.com>
Date: Mon, 21 Apr 2008 11:39:16 +1200
Local: Sun, Apr 20 2008 7:39 pm
Subject: Re: [Rails-core] [RFC] Connection pools for AR
> - One connection pool object created and cached per Excellent! > AR::Base.establish_connection call. > - Connection pool manages the individual connections. Currently it's This will be the biggest change, we can do implicit checkout of a > still a hash of connections per thread but it should be easy to move > to a proper fixed pool with connection acquire/release functionality. > - At some point, in order to leverage fixed-size connection pools, connection when trying to access the database for the first time in a thread, but implicit checkin seems to be asking for trouble. We can handle it for ActionController easily enough by checking the connections back in after the request has been dispatched. So my first thought is: Foo.find(:first) # retrieves connection With retrieving blocking until the connection is available. > - Connection API has not changed significantly, but I hope to at least There are two cases that I'm aware of that lead to those 'interesting' methods. > make the connection pool API more sane and deprecate and/or remove a > lot of the cruft like > active_connection/clear_active_connections!/clear_reloadable_connections!/v erify_active_connections! > etc. Anyone who uses these or knows the original intent of these, > please let me hear more about it. Their purpose seems less clear in > light of the refactoring so far. * Reloading in development mode (the classes get undefined, so the By moving the connections to the pool rather than the classes that get So with a proper 'pool' we can avoid all those methods, and improve > This might seem like YAGNI for a lot of you, but I think it has the The code cleanup is pretty desperately needed, it's some hokey nasty > dual benefit of cleaning up the connection_specification code, plus > supporting the endgame for my standpoint, which is making the > connection pool implementation pluggable so that I can use the Java > application server's connection pool when running with JRuby. stuff ;). The dual benefit of getting jruby connection handling a little easier is a definite win. > Comments appreciated! Rather than swapping in and out a different monitor, why not have two different connection handler classes, one of which returns and manages a single connection, and another which manages a pool of a fixed size. The single connection version can expose the same API (checkout / check in / release) and perhaps raise exceptions if accessed from threads other than the one which created the connection. new-connection-per-thread isn't a particularly great idea and I'd be Thanks for your work on this, it'll be good to tidy this up. There are still a bunch of outstanding issues to be decided, > /Nick -- > [1]: http://github.com/nicksieger/rails/commits/connection_pool Cheers Koz You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||