APoolSize of TDBConnectionPool is ignored when running on Linux


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?

Kind regards,


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.

Hi Wagner,

Thank you that explains what we're seeing. I wasn't aware of that.

How would you manage the database connection limit with a apache web broker? Limit the number of launched modules in the apache config?

The apache module logs on startup, wouldn't you expect that it would log the start up procedure each time Apache launches an instance?

Because we do not see that.

I'll test some with the apache settings:

Do you have better suggestions?

You can check here: worker - Apache HTTP Server Version 2.4.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.