When the number of connection to your database increases, you can see below error:
Neo4jError: There are no available threads to serve this request at the moment.
You can retry at a later time or consider increasing max thread pool size for bolt
To deal with the issue, take a look at thread pool size. Because there will be tons of idle connection, you should set
withMaxConnectionPoolSize in the driver objects.
The default setting for maxConnectionPoolSize is 200. If its one driver object per customer then it should/can be as low as they can go. If you have one driver object for high number of customers, then you can set it to a larger number by taking average of your low and high traffic.
The suggested setting for
withMaxConnectionPoolSize is 20 and it can be tuned the value based on the setup and load on the database.
Config config = Config.builder()
.withMaxConnectionLifetime( 30, TimeUnit.MINUTES )
.withMaxConnectionPoolSize( 20 )
.withConnectionAcquisitionTimeout( 2, TimeUnit.MINUTES )
.build(); Driver driver = GraphDatabase.driver( uri, AuthTokens.basic( user, password ),