Menu

FastestConnectServerSet: how many TCP connections does it use?

2019-03-05
2019-03-05
  • Surendar Chandra

    I'm using a FastestConnectServerSet for my LDAP connection pool. Suppose I have a pool with initialConnections=1, maxConnections=10 and total #servers=20. How many active TCP connections would I see when there is little to no LDAP traffic. I expect 1 TCP + 20 temporary probes but I seem to see way too many TCP connections. On a controlled setup, I only see 1 TCP connection but don't have visibility into when it grows. Thanks again.

     
  • Neil Wilson

    Neil Wilson - 2019-03-05

    If you have a pool configured with the FastestConnectServerSet, then whenever the pool needs to establish a new connection, it will create a separate thread for each server in the set. The first thread that is able to successfully connect, authenticate, and pass any associated health checking will have its connection added to the pool, and all of the other connections from all of the other threads will be discarded. So when you’re actively trying to establish a connection, you can see up to one TCP socket for each server in the set for that connection attempt.

    When the pool isn’t actively trying to establish a new connection, then the choice of server sets shouldn’t impact the number of sockets that are in use. So there should be one TCP socket for each established connection.

    If you do have 20 servers in the set, then each time you try to establish a new connection for the pool, then the FastestConnectServerSet could try to create 20 new connections and just take the fastest one. That does seem like a lot. Are all of the servers in the same data center and have the same relative precedence? If not, then you could divide them up into smaller sets (for example, grouped by data center), and then use the FailoverServerSet across each of those sets. In that way, it will only try to establish a connection to one of the servers in the first set, and will only move on to one of the other sets if none of the servers in the first set are available. If you use the FastestConnectServerSet in conjunction with the FailoverServerSet, then it’ll only try to establish connections to one of the servers in the first subset, rather than to all of them.

    If you do have 20 servers and they’re all equally preferable, then maybe another server set (perhaps something like the FewestConnectionsServerSet) would be a better choice.

     

Log in to post a comment.