question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DROID opens multiple connection pools to the same database.

See original GitHub issue

When 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.

  1. DROID used to have a single data source for the embedded derby database (which is all that is needed).
  2. 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.
  3. 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.
  4. 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:closed
  • Created 4 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
nishihatapalmercommented, Jan 27, 2020

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.

0reactions
nishihatapalmercommented, Jan 29, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found