简体   繁体   中英

Vaadin + Spring boot application very slow after long idle time

I have a performance problem with my Vaadin 8 + Spring Boot application.

When I start the application after a long time without using, for example after one night, it tooks several minutes to get the response from the database.

I have following application settings:

    spring.datasource.max-active=10
    spring.datasource.initial-size=5
    spring.datasource.max-idle=5
    spring.datasource.min-idle=1
    spring.datasource.test-while-idle=true
    spring.datasource.test-on-borrow=true
    spring.datasource.validation-query=SELECT 1
    spring.datasource.time-between-eviction-runs-millis=5000
    spring.datasource.min-evictable-idle-time-millis=60000

Without test-while-idle , validation-query and test-on-borrow I couldnt even reconnect to the database again but the performance problem is still present.

That looks like a JDBC connection which has been idle so long it has been timed out on the TCP/IP level. I wonder if there is either a setting that would auto-close JDBC connection after it has not been used for, say, 2 minutes. Or a heart-beat setting that would issue SELECT 1 every 5 minutes on all JDBC connections, to keep it alive.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM