Managing MySQL connections using HikariCP and Slick -
i'm running scala application on software stack:
mac os x 10.6.8 snow leopard mysql 5.1.46 java 1.6.0_65 scala 2.11.2 connectorj 5.1.33 hikaricp 2.1.0 slick 2.1.0
i cannot why open connections mysql maintain staying open after shutting scala app down. right aspect threads_connected drops 16 downwards 1 (that console i'm executing 'show status' command.
mysql> show status '%onn%'; +--------------------------+-------+ | variable_name | value | +--------------------------+-------+ | aborted_connects | 0 | | connections | 77 | | max_used_connections | 19 | | ssl_client_connects | 0 | | ssl_connect_renegotiates | 0 | | ssl_finished_connects | 0 | | threads_connected | 1 | +--------------------------+-------+ 7 rows in set (0.00 sec)
the unusual thing see open connections db growing maximum number of open connections set in connection pool (hikaricp maximumpoolsize) every time run app hence can state connections never given connection pool reuse.
according slick documentation using
db withsession { implicit session => /* entering scope, getting 1 conn pool */ /* within session using connection i've gotten */ } /* here i'm out of 'withsession' scope, , connection should released */
will take connection pool when entering scope , release out of scope
am doing wrong or did wrong connection pool usage on software stack?
connections
counter of how many connection attempts have been made since lastly time started mysqld. counter increases; not decrease when connections end.
that counter not number of current connections -- that's threads_connected
.
mysql slick hikaricp connector-j
No comments:
Post a Comment