DROID opens multiple connection pools to the same database.
See original GitHub issueWhen DROID starts, it opens multiple connection pools to the same database. This can be seen in the logs when it starts, the HikariPool
is initialised multiple times. This is slow and unnecessary.
I’ve traced why this happens in the git history.
- DROID used to have a single data source for the embedded derby database (which is all that is needed).
- A connection pool was added to improve performance. It’s unlikely that this improved performance, since DROID opens a few connections to the database and holds on to them as long as it needs to. It isn’t a server application trying to share scarce database connections among thousands of concurrent connections.
- A factory for the connection pool was added later. This seems to be because of strange initialisation / dependency issues in spring initialisation. The factory also reloads the driver class every time it creates a new pool.
- All the things that used to get the connection pool now get a new connection pool from the factory.
The net result is that all the things that just need an occasional database connection now get a connection pool to themselves (and try to reload the database driver).
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Is it smart to open multiple connections on the same database ...
Yeah, its smart to set up multiple connection using connection pool for many reasons. Using a connection/statement pool, you can reuse existing ...
Read more >How to prevent connection pool problems between ASP.NET ...
i.e. If you are opening a connection and not closing it properly, then there will be multiple open connections, causing this error.
Read more >Connection Pooling in Java - DigitalOcean
Connection pooling means a pool of Connection Objects. Connection pooling is based on an object pool design pattern. Object pooling design ...
Read more >B4J Connection Pool Examples? | B4X Programming Forum
Currently I'm opening a single connection to the database at program start and using that connection whenever I need one. If the program...
Read more >Improved Performance with a Connection Pool - Developer.com
The database connection pools need to be notified about this event so that all connections can be closed correctly. The DBConnectionManager ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m working on how to fix this. Everything still works, so there’s no massive issue here, but it would be nice to clean this up.
I also misunderstood @adamretter 's suggestion to mark it as a singleton. I thought we were talking about a single factory, rather than a single output from the factory. Thanks Adam.