[Ruby] Per user IO connections in Rails?
Atom Powers
atom.powers at gmail.com
Thu May 22 08:47:23 PDT 2008
On Wed, May 21, 2008 at 5:11 PM, Scott Windsor <swindsor at gmail.com> wrote:
> If you really need to keep around these LDAP connections on a per-user
> basis, you really want to create a connection pool that stores all of these
> connections globally. You should be careful though, because depending on
> your deployment configuration, you could run into contention issues with
> multiple threads accessing the same pool. Additionally, keeping all of
> these connections will be expensive, so you'll want to ensure that you have
> a good way of cleaning up after them after they've been idle for some time.
>
Thank you, I think I found a way to work with a connection pool.
Unfortunately I have no idea how threads work, so I wouldn't even be able to
guess if I will have contention issues. But I'll have to work on that later.
> The other alternative is to avoid keeping a connection pool and cache
> whatever data you need from ldap in the user's session. You don't want
> store anything other than data in the session, and you should make sure
> that
> whatever session storage solution you pick either has enough room to store
> the data you need (in the case of using cookie storage), or is going to be
> faster than going back out to ldap (in the case of database storage or
> memcache).
Well, I *really* don't want to store the password in the session hash, which
would be required to re-create the ldap connection. And caching ldap data in
a database seems excessively wasteful and not at all DRY.
--
--
Perfection is just a word I use occasionally with mustard.
--Atom Powers--
More information about the Ruby
mailing list