We're using a webbroker with an apache server in Linux (TWebBrokerServer). And a databaseserver PostgreSQL.
Our postgres database server is limited to a number of connections which result in failures when all connections are occupied by the TDBConnectionPool.
Recently we found out that the number of connections exceeds the APoolSize.
We've created a pool with only 1 connection:
ConnectionPool := TDBConnectionPool.Create(1,DBConnectionFactory);
We've tested with Windows using THttpSysServerConfig and see that the maximum number of connections is kept to 1.
But when we've build the apache webbroker module, the number of connections ignores the APoolSize setting. And then exceeds the 1 connection by far.
I've already updated to the latest versions today. But with no luck.
Also, does the connectionpool free idle connections? If so, when? I've found the setting ACleanupTimeoutMS, what does this setting do?
It's important to understand how Apache and Delphi Web Broker work.
Delphi creates an Apache module that is a dll file. Such file is loaded by Apache, and might be loaded (launched) multiple times. So even if in your DLL the pool is configured to have size 1, if Apache launches several instances of your module, then you will have several different pools of size 1.
That's probably the cause of the symptom you are seeing.