first experience trying out HikariCP

2,196 views
Skip to first unread message

Mark Anderson

unread,
Jan 14, 2014, 1:03:46 AM1/14/14
to hika...@googlegroups.com
hi -
i've been a user of BoneCP, and decided this evening to try out HikariCP.
Just FYI here are the issues i've run into so far, which I'm providing just
since my eyes are fresh....

1. main page of web site has not a single example showing actual java package names?

2. apparently i can't supply a pre-existing DataSource to be wrapped. BoneCP has this feature,
and I have to have it. With JNDI etc. I might not have access to user and password and so on.

3. HikariPool isn't public. HikariDataSource doesn't expose the stats. So i have no way of 
easily showing current stats like idle connections, unless perhaps i delve into that mbean
stuff - but then the docs better provide some working sample code.

Thanks.

Brett Wooldridge

unread,
Jan 14, 2014, 1:16:27 AM1/14/14
to
Hi Mark,

Thanks for trying out HikariCP.  I'll add an example on the main page with package names.  Our assumption was that anyone with an IDE, and the HikariCP jar, would be able to simply auto-complete the package import when typing the class HikariConfig or HikariDataSource.

HikariCP does not provide a way to specify a DataSource programatically.  This is simple, so please submit an enhancement request on the Github page.

As noted, pool stats are available through the MBean, see this example here:


UPDATE: also, debug logging enabled for the HikariPool class will log pool statistics every 30 seconds.

Mark Anderson

unread,
Jan 14, 2014, 1:47:56 AM1/14/14
to hika...@googlegroups.com
Thanks Brett.

I've submitted an issue in github for DataSource. Looks like I'm the first :)

Unless I'm blind I don't see anything on your single-page doc about how to enable debug logging?

In that post you reference about using the mbean, what does that "foo" in the ObjectName signify?
Does it have to match anything else?

-mda

Brett Wooldridge

unread,
Jan 14, 2014, 7:22:22 PM1/14/14
to
Hi Mark,

As noted in the Requirements section on the page, HikariCP uses slf4j (Simple Logging Framework for Java), follow the slf4j configuration guides for how to configure logging.  In the absence of slf4j configuration, slf4j will use what is called a SimpleLogger which outputs to stderr.  In that case you can enable debugging across the board, for example, by specifying a system property:

-Dorg.slf4j.simpleLogger.defaultLogLevel=debug

Re: your mbean question, mentioned in that post just above the code snippet is:

The MBean is registered with the name: 
     com.zaxxer.hikari:type=Pool (<poolName>)
where poolName is a name you can set on the HikariConfig using config.setPoolName("foo"), for example.

so you can set the pool name to anything you want, for example, config.setPoolName("Mark"), then retrieve the pool mbean via:

ObjectName poolName = new ObjectName("com.zaxxer.hikari:type=Pool (Mark)");

The only requirement is that the names are unique, i.e. two HikariCP pools cannot be constructed with the same name.

Reply all
Reply to author
Forward
0 new messages