> On Mar 20, 2021, at 10:40 PM, Emmanuel Lécharny <elecha...@gmail.com> wrote: > > I guess that the very first time we create the connection, when asking for > one from a pool, we test it beforehandd, and this is done with the less > costly operation: a dummy search. > > This is due to commons-pool logic where you can ask the pool to validate the > connection one way or the other. We are probably using > LookupLdapConnectionValidator for that purpose:
Hi Emmanuel, It’s actually sending that dummy search every time, which of course isn’t good. Here’s the code to create the pool: ``` // Create the Admin pool adminPool = new LdapConnectionPool( poolFactory ); adminPool.setTestOnBorrow( true ); adminPool.setWhenExhaustedAction( GenericObjectPool.WHEN_EXHAUSTED_GROW ); adminPool.setMaxActive( max ); adminPool.setMinIdle( min ); adminPool.setMaxIdle( -1 ); adminPool.setTestWhileIdle( testWhileIdle ); adminPool.setTimeBetweenEvictionRunsMillis( timeBetweenEvictionRunMillis ); ``` Notice that ‘setTestOnBorrow' being set to true. When I flip that switch, the dummy search no longer occurs when connection is retrieved, which is `good. Wonder what we lose. Recovery from connections being timed out by server or reset by intermediaries like routers? Must do more testing… — Shawn --------------------------------------------------------------------- To unsubscribe, e-mail: api-unsubscr...@directory.apache.org For additional commands, e-mail: api-h...@directory.apache.org