--
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/237a3003-1430-4468-a4e3-5bcbdaa4cd74%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I believe this is the default liveness check for the connection pool to determine if a connection in the pool is still “good” or not.
On Fri, Jun 7, 2019 at 5:30 PM Radomir Djurdjevic <rax...@gmail.com> wrote:
Hi guys,--I have an issue with a health check query that appears approximately 10 times each time connection is established, although I've never set this check explicitly. It's the validation query:/* Health Check */ SELECT 1In the config.yml I use for running the service there is no valiidationQuery property set, which makes me wonder where is this health check coming from. I do not have any other health checks put in place, so it can't be coming from the health module.Does anyone have an idea what could be making the health check?I am using:
- Java 8
- PostgreSQL 11
- DropWizard 1.3.5
- JDBI3
Thanks a lot,Rasha
You received this message because you are subscribed to the Google Groups "dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwiz...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/8f16d874-8335-441a-9638-4eee74382057%40googlegroups.com.
Hi,Here is the section of configuration.yml relevant for the database (access data excluded):database:
driverClass: org.postgresql.Driver
# the username
# the password
# the JDBC URL
properties:
charSet: UTF-8
maxWaitForConnection: 1s
# validationQuery: "/* MyService Health Check */ SELECT 1"
validationQueryTimeout: 3s
minSize: 8
maxSize: 32
checkConnectionWhileIdle: false
evictionInterval: 10s
minIdleTime: 1 minuteI have commented the validationQuery property, so the default value is used.Small correction from my side: the validation query runs 8 (not 10 as I mistakenly said before) times, which equals to minSize property. These connections are created on application start, but also then every time a new HTTP request comes in which uses some of the generated JDBI DAOs. All validation queries are switch state quickly to idle but are not cleaned up.I am tempted to set up Hikari connection pool, but seeing that other queries seem to be closed properly and only the validation query is an issue, I would rather resolve that first before inserting an additional component to the system.I appreciate the feedback.Regards, R.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/dd4422e7-8065-4268-b19f-6570eba4333b%40googlegroups.com.
Yes, it does make sense, thanks for the advice. Unfortunately it didn't work out for me so well, issue continues to persist, connections are being created for the validation query and they are never released. Last time it got up to 80 idle connections used by the query. There must be something about JDBI3 I don't fully understand - I set maxSize to 32 and it still somehow manages to get to 80 connections.I'm using the default configuration now, but without success.I would appreciate it if someone could point me in the right direction.Thanks, R.
To unsubscribe from this group and stop receiving emails from it, send an email to dropwizard-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dropwizard-user/9109de30-77df-4549-8135-b89673330a91%40googlegroups.com.
Cause of the issue lied in the missing @Singleton annotation. Since JDBIFactory was extended and the provide() method had to be overridden in order to create valid Jdbi instances, the method had to be marked as a singleton explicitly in order to avoid it being called multiple times.
@Override @Singleton public Jdbi provide() { Jdbi jdbi = super.provide().installPlugin(new PostgresPlugin()); return jdbi; }
As the method wasn't annotated with @Singleton, it was being run with every call to the DAO layer, which in turn kept creating 8 new connections (equal to minSize property of the connection pool, taken from the application config file) on each call.
Since I use HK2 for DI, I needed an additional library (https://github.com/alex-shpak/dropwizard-hk2bundle) to make things work. The JDBIFactory class comes from the library and the provide() method is the one I had to override.