If you have been working with Docker Compose stacks for a while, you might have come across the following warning message:
WARNING: Connection pool is full, discarding connection <IP Address>. Usually, the root cause it’s due to an application connection pool misconfiguration between the maximum number of connections in a pool and the number of requests running in parallel.
- Docker Compose
Solution 1. Try to recreate the stack and remove any unused networks.
docker-compose down docker network prune docker-compose up -d
Solution 2. Alternately, increase the limit for the number of tasks/operations that could be run in parallel. Although the default value is
64 according to the docs, increasing parameter values is not always the best practice approach, but it might work. So, here are a few ways to override the
From the CLI, as an environment variable on your host machine:
A much better approach would be to include it in an .env file by being referenced in a Docker Compose file. For instance:
Solution 3. Increase the connection pool in the application itself (not recommended).
If there is a better solution or approach, let me know in the comments below. On a side note, follow our official channel on Telegram.