[Freeipa-devel] [PATCH] new LDAP connection pool
Rob Crittenden
rcritten at redhat.com
Mon Oct 8 20:21:37 UTC 2007
The old connection pool lacked locking and would iterate over the entire
list for each request.
I've changed it to use a dict of connections keyed on principal.
There is a separate list keyed on principal that holds the order of the
entries.
When an entry is requested it looks for it in the dictionary and if
found, pops it off the list too.
When finished, it creates a new dict entry for it then appends it to the
end of the list (so it is the most recently used).
If we ever have a full list, just pop element 0 as it is the LRU.
Remember that Apache is running multi-process so each process will have
its own connection cache. This limits the effectiveness of the pooling
but I suspect that with the GUI it will help somewhat.
This is the reason I've gone with a fairly conservative value for the
max number of entries at 128.
It seems fairly weak in terms of catching possible errors. Some
suggestions would be helpful. I don't think it can blow up and leave a
hanging lock, so it won't hork the server. I also don't want to go
overboard and put try/except around every call (or should I?)
rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-253-pool.patch
Type: text/x-patch
Size: 5313 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20071008/ab8f2627/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3245 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20071008/ab8f2627/attachment-0001.bin>
More information about the Freeipa-devel
mailing list