[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: back-ldap connection caching

Pierangelo Masarati wrote:
After running SLAMD against back-ldap I've noticed some problems in the
approach - while a single load generator may send multiple requests over a
single connection, back-ldap always creates new connections for each
Simple Bind, and leaves them available to be shared by other sessions.

We cured this by forcing back-ldap to always use idassert: this way, binds are done with dedicated (serialized) "privileged" connections pool, and the rest goes into the usual privileged connections pool.

Sure, but we can avoid some of this serialization.

I think that's how it is right now: implicit binds go into the lists of
privileged connections, while the AVL holds only connections resulting
from explicitly bound requests.  What's treated separately right now, and
needs to be so, is connections for explicit binds: they shouldn't get into
the AVL at all until the bind succeeds (see ITS#5154 wrt/ back-meta).

Hm, if privileged connections are always pooled separately and never in the AVL, then we can just get rid of the DN comparison portion of the AVL lookups.

Another thing we could do to simplify this management is replace the AVL with an array of pointers, and use the conn_idx to check immediately for an explicitly bound connection. (The conn_idx was added for the benefit of the ppolicy overlay, but we ought to have used it here as well.)

One thing that probably should default to "on" is single-conn: this
feature forces back-ldap to uncache connections when rebinding.  In fact,
the usual behavior only makes sense when a client plans to repeatedly bind
on one connection with different identities, and do something with those
identities.  In this case, if the client at some point needs to re-use an
identity that was used earlier, the connection will already be available.
With single-conn on, as soon as a client rebinds on an existing
connection, the old one is removed.

If the client is issuing Bind requests anyway, there's no need to keep the old identities around. It should just keep re-using the same connection over and over.

A totally different approach, but probably not worth except when the
number of identities is guaranteed to be small, consists in caching
connections based on the identity only.  In that case, multiple clients
binding with the same connection could re-use the same connection.  This
approach could be used by extending the concept of "privileged connection"
to a set of limited, well-known privileged users.

Right. In the current case, where a small number of clients are binding to a large number of different identities, it wouldn't be any benefit.
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/