Thank you for the info. On Mon, Feb 6, 2017 at 2:05 PM Barry Oglesby <bogle...@pivotal.io> wrote:
> The max-connections property configures the maximum number of client > connections that can be created on a server. > > If a set of clients is attempting to create >800 connections to the same > server either during an operation or while prefilling its pool of > connections, a warning like this is logged on the server: > > [warning 2017/02/06 13:12:34.846 PST server-1 <Handshaker > 0.0.0.0/0.0.0.0:50780 Thread 0> tid=0x3c] Rejected connection from /xxxxx > because current connection count of 800 is greater than or equal to the > configured max of 800 > > And a warning like this is logged on the client: > > [warning 2017/02/06 13:29:35.048 PST client-feeder <Thread-13> tid=0x1e] > Could not create a new connection to server: > xxxxx(server-1:8657)<v16>:21156 refused connection: exceeded > max-connections 800 > > And an exception like one of these is thrown on that client: > > During an operation: > > com.gemstone.gemfire.cache.client.NoAvailableServersException: > com.gemstone.gemfire.cache.client.ServerRefusedConnectionException: > xxxxx(server-1:8657)<v16>:21156 refused connection: exceeded > max-connections 800 > ... > at > com.gemstone.gemfire.internal.cache.LocalRegion.put(LocalRegion.java:1580) > at > > com.gemstone.gemfire.internal.cache.AbstractRegion.put(AbstractRegion.java:327) > at TestClient$1.run(TestClient.java:74) > at java.lang.Thread.run(Thread.java:745) > Caused by: > com.gemstone.gemfire.cache.client.ServerRefusedConnectionException: > xxxxx(server-1:8657)<v16>:21156 refused connection: exceeded > max-connections 800 > at > > com.gemstone.gemfire.internal.cache.tier.sockets.HandShake.readMessage(HandShake.java:1466) > at > > com.gemstone.gemfire.internal.cache.tier.sockets.HandShake.greet(HandShake.java:1317) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionImpl.connect(ConnectionImpl.java:112) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:134) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:252) > at > > com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.borrowConnection(ConnectionManagerImpl.java:214) > > During prefill: > > [info 2017/02/06 13:48:46.772 PST client-feeder <poolTimer-pool-3> > tid=0x16] Error prefilling connections : > com.gemstone.gemfire.cache.client.ServerRefusedConnectionException: > xxxxx(server-1:8796)<v19>:9152 refused connection: exceeded max-connections > 800 > com.gemstone.gemfire.cache.client.ServerRefusedConnectionException: > xxxxx(server-1:8796)<v19>:9152 refused connection: exceeded max-connections > 16 > at > > com.gemstone.gemfire.internal.cache.tier.sockets.HandShake.readMessage(HandShake.java:1466) > at > > com.gemstone.gemfire.internal.cache.tier.sockets.HandShake.greet(HandShake.java:1317) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionImpl.connect(ConnectionImpl.java:112) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:134) > at > > com.gemstone.gemfire.cache.client.internal.ConnectionFactoryImpl.createClientToServerConnection(ConnectionFactoryImpl.java:252) > at > > com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefillConnection(ConnectionManagerImpl.java:794) > at > > com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl.prefill(ConnectionManagerImpl.java:737) > at > > com.gemstone.gemfire.cache.client.internal.pooling.ConnectionManagerImpl$PrefillConnectionsTask.run2(ConnectionManagerImpl.java:888) > > Either way, the server won't allow additional connections to it, and the > client operation will fail. > > There are a few things you can do: > > - increase max-connections to accomodate all the client connections > - handle the NoAvailableServersException by retrying. The hope is that the > retry will find an available connection rather than having to create a new > one > - limit the number of client connections with the max-connections pool > attribute. If max-connections is set and all client connections are in use, > a thread will wait for an available connection (for up to 10000 ms by > default controlled by the free-connection-timeout pool attribute) before > throwing an exception. > > Also, just because there are 800 threads doing operations doesn't > necessarily mean there are 800 connections. Each client has a pool of > connections that its threads can use. In the extreme case, if there are 800 > threads on a single client, its pretty unlikely that there will be 800 > connections. Instead, its likely that a thread will find an available > existing connection rather than having to create a new one. > > > Thanks, > Barry Oglesby > > > On Mon, Feb 6, 2017 at 12:20 PM, Goutam Tadi <gt...@pivotal.io> wrote: > > > Hi, > > > > I have a couple of questions regarding max-connections attribute in > > cache.xml. > > > > 1. If max-connections is set to 800 by default, does that mean if I have > > 800+ region.put() methods from multiple clients in parallel, Will this > > cause issue to some of the inserts or requests from server ? > > > > 2. If I would like to try multi threading (inserts/puts) by buffering > rows > > to some size of 1MB and use putAll() to insert batch of rows into a > region > > with max-connections set to 800 by default, will this cause issue to the > > client, if the client launches 800+ threads of batch inserts ? > > > > > > Thanks, > > Goutam Tadi. > > -- > > Regards, > > *Goutam Tadi.* > > > -- Regards, *Goutam Tadi.*