Reputation: 1334
I am new in the hibernate's cache area.
Regards, Marcin
Upvotes: 38
Views: 27008
Reputation: 1334
I have found nice tool that vizuliaze hibernate usage (also cache). Additionaly in these articles (here is part one) there is quite good explanation how the hibernate cache works (see also related links). There is also nice example with analysis steps.
Anyway thanks for answers.
Upvotes: 7
Reputation: 242706
You can enable Hibernate statistics generation be setting hibernate.generate_statistics
property to true
. Then you can monitor cache hit/miss count via SessionFactory.getStatistics()
.
Also, when SQL logging is enabled you can analyze cache behaviour by presence or absense of particular SQL queries.
It depends on many factors. See 21.2. The Second Level Cache and 21.4. The Query Cache
It depends on cache provider and its configuration. For example, EhCache can be configured to overflow to disk.
SessionFactory.getStatistics().getSecondLevelCacheStatistics()
provides this information.
Upvotes: 25