2021年1月24日 星期日

HikariCP Example

Java 6
https://github.com/imrexhuang/HikariCPClientExample/tree/master/ForJava6

Java 8+
https://github.com/imrexhuang/HikariCPClientExample/tree/master/ForJava8%2B

HikariCP
https://github.com/brettwooldridge/HikariCP#configuration-knobs-baby

HikariCP Maven:
https://search.maven.org/search?q=com.zaxxer.hikaricp

作者:Brett Wooldridge
https://github.com/brettwooldridge

作者為何要開發HikariCP的專訪
https://dzone.com/articles/jooq-tuesdays-what-it-takes-to-write-the-fastest-java-connection-pool

【追光者系列】HikariCP默认配置


利用SQL Server的sp_who指令查看
沒有設定setMinimumIdle和setMaximumPoolSize時,的確預設是建立10個Connection


超過預設10個Connection會出現以下錯誤訊息,無法再用HikariDataSource去getConnection導致timeout:

java.sql.SQLTimeoutException: Timeout after 30004ms of waiting for a connection.
    at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:233)
    at com.zaxxer.hikari.pool.BaseHikariPool.getConnection(BaseHikariPool.java:183)
    at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:93)
    at HikariCPDataSource.getConnection(HikariCPDataSource.java:33)
    at SQLServerPOC.main(SQLServerPOC.java:25)