Hibernate.orgCommunity Documentation

Chapter 8. Monitoring

8.1. JMX
8.1.1. StatisticsInfoMBean
8.1.2. IndexControlMBean
8.1.3. IndexingProgressMonitorMBean

Hibernate Search offers access to a Statistics object via SearchFactory.getStatistics(). It allows you for example to determine which classes are indexed and how many entities are in the index. This information is always available. However, by specifying the hibernate.search.generate_statistics property in your configuration you can also collect total and average Lucene query and object loading timings.

You can also enable access to the statistics via JMX. Setting the property hibernate.search.jmx_enabled will automatically register the StatisticsInfoMBean. Depending on your the configuration the IndexControlMBean and IndexingProgressMonitorMBean will also be registered. In case you are having more than one JMX enabled Hibernate Search instance running within a single JVM, you should also set hibernate.search.jmx_bean_suffix to a different value for each of the instances. The specified suffix will be used to distinguish between the different MBean instances. Let’s have a closer look at the mentioned MBeans.

This MBean allows to build, optimize and purge the index for a given entity. Indexing occurs via the mass indexing API (see Section 6.3.2, “Using a MassIndexer”). A requirement for this bean to be registered in JMX is, that the Hibernate SessionFactory is bound to JNDI via the hibernate.session_factory_name property. Refer to the Hibernate Core manual for more information on how to configure JNDI. The IndexControlMBean and its API are for now experimental.