What version of Geode are you using? I ask because on develop there is a yet to be release fix to connection pooling for the Java client. The same fix has not been rolled out to the C++ client. For version 1.9 and older if you are using lots of threads in your client you will want to enable thread local connection pooling.
Java: https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/client/PoolFactory.html#setThreadLocalConnections-boolean- <https://geode.apache.org/releases/latest/javadoc/org/apache/geode/cache/client/PoolFactory.html#setThreadLocalConnections-boolean-> C++: https://geode.apache.org/releases/latest/cppdocs/a00789.html#a62f037e2c91bc6869fafaad690040322 <https://geode.apache.org/releases/latest/cppdocs/a00789.html#a62f037e2c91bc6869fafaad690040322> In both C++ and Java clients the creation of new connections is caused by an exhausted pool. If you request a connection to a specific server, like when doing single hop, if there are no connections currently in the pool then a new connection is created. The apparent difference in Java and C++ is likely caused by differences in lock contention in the pool. The Java client had serious lock contention that keep utilization low, which is fixed in develop (1.10). Thread local connections was an old attempt to address this issue but resulted in lots of connections being idle in a single-hop scenario. -Jake > On Jul 23, 2019, at 7:39 AM, Alberto Gomez <alberto.go...@est.tech> wrote: > > Just a small correction on my original e-mail. > > When I said that "connections are closed because the server considered > them idle" I meant that "connections are closed because the client > library considered them idle". > > Best regards, > > Alberto > > On 23/7/19 14:48, Alberto Gomez wrote: >> Hi, >> >> I have run some tests using two different clients, a Java one and a C++ >> one, both with single hop enabled, maxConnections not limited (set to >> -1), accessing a partitioned region, and have observed the following: >> >> - If the amount of operations sent to the Geode cluster is not very >> high, the number of connections from the client to the servers remains >> constant and reasonably low (the number appears to be (number of threads >> in the client * number of servers in the Geode cluster)). >> >> - If the amount of operations sent to the Geode cluster is very high >> then the behavior seems different between the Java and the C++ client: >> >> * With the Java client, the number of connections seems to be >> bounded to a maximum that seems to be (number of threads in the client * >> number of servers) although there is a continuous thrashing of >> connections (connections closed and opened continuously). According to >> my observations, the reason why connections are closed is because the >> server considers them idle. >> >> * With the C++ client, the number of connections seems to grow >> indefinitely and quite quickly. In this case, the amount of connections >> closed (if any) seems very small. This is a problem because sooner or >> later the client runs out of file descriptors. >> >> I have some questions regarding the observed behavior: >> >> - What fires the creation of new connections in the Java case? Is there >> a limit for the number of connections opened (there seems to be one)? >> >> - In the Java case, what could be causing that some connections are idle >> given that the amount of operations sent is very high? >> >> - In the C++ case, what fires the creation of new connections? >> >> - In the C++, is it normal that the number of connections grows >> indefinitely? >> >> - Is there a reason for the two client APIs to behave differently (in >> the Java one connections expire while in the C++ connections do not expire)? >> >> >> Thanks in advance, >> >> Alberto >> >>