Help

Emmanuel mentioned in his previous Search post the new Statistics interface which is new in Hibernate search 3.3 (latest version 3.3.0.Beta1). I thought it is time to write a little bit more about it. The API is actually self-explanatory:

package org.hibernate.search.stat;
...
public interface Statistics {
    /**
     * Reset all statistics.
     */
    void clear();

    /**
     * Get global number of executed search queries
     *
     * @return search query execution count
     */
    long getSearchQueryExecutionCount();

    /**
     * Get the total search time in nanoseconds.
     */
    long getSearchQueryTotalTime();

    /**
     * Get the time in nanoseconds of the slowest search.
     */
    long getSearchQueryExecutionMaxTime();

    /**
     * Get the average search time in nanoseconds.
     */
    long getSearchQueryExecutionAvgTime();

    /**
     * Get the query string for the slowest query.
     */
    String getSearchQueryExecutionMaxTimeQueryString();

    /**
     * Get the total object loading in nanoseconds.
     */
    long getObjectLoadingTotalTime();

    /**
     * Get the time in nanoseconds for the slowest object load.
     */
    long getObjectLoadingExecutionMaxTime();

    /**
     * Get the average object loading time in nanoseconds.
     */
    long getObjectLoadingExecutionAvgTime();

    /**
     * Gets the total number of objects loaded
     */
    long getObjectsLoadedCount();

    /**
     * Are statistics logged
     */
    public boolean isStatisticsEnabled();

    /**
     * Enable statistics logs (this is a dynamic parameter)
     */
    public void setStatisticsEnabled(boolean b);

    /**
     * Returns the Hibernate Search version.
     *
     * @return the Hibernate Search version
     */
    String getSearchVersion();

    /**
     * Returns a list of all indexed classes.
     *
     * @return list of all indexed classes
     */
    Set<String> getIndexedClassNames();

    /**
     * Returns the number of documents for the given entity.
     *
     * @param entity the fqc of the entity
     *
     * @return number of documents for the specified entity name
     *
     * @throws IllegalArgumentException in case the entity name is not valid
     */
    int getNumberOfIndexedEntities(String entity);

    /**
     * Returns a map of all indexed entities and their document count in the index.
     *
     * @return a map of all indexed entities and their document count. The map key is the fqc of the entity and
     *         the map value is the document count.
     */
    Map<String, Integer> indexedEntitiesCount();
}

Access to the statistics is via SearchFactory.getStatistics(). The information about which classes are indexed and how many entities are in the index will always be available. However, the query and object loading timings will only be collected if the property hibernate.search.generate_statistics is set in your configuration. I am thinking about introducing an additional interface in order to make this separation more obvious. WDYT?

The new statistic and monitoring functionality does not end here. You can also enable access to the statistics via JMX. Setting the property hibernate.search.jmx_enabled will automatically register the StatisticsInfoMBean with the MBeanServer. On top of this MBean there are two more MBeans - IndexControlMBean and IndexingProgressMonitorMBean - which will or will not be available depending on your configuration and the state of the application.

The IndexControlMBean allows you to build, optimize and purge the index for a given entity. Indexing occurs via the mass indexing API. 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 API are for now just experimental.

Last but not least, the IndexingProgressMonitorMBean. This MBean is an implementation of the MassIndexerProgressMonitor interface. If hibernate.search.jmx_enabled is set and the mass indexer API is used the indexing progress can be followed via this MBean. The bean will only be bound to JMX while indexing is in progress. Once indexing is completed the MBean is not longer available. Again, this API is for now experimental.

Do you think this new monitoring and statistic API it is valuable? Are you missing any functionality? Let us know and use the Search forum or Jira to suggest new features or to report a bug.

Enjoy!

14 comments:
 
24. Sep 2010, 13:46 CET | Link
Sanne

great job! I didn't know you where working on such a complete API. Would it make sense to be able to ask the API about which queries where slow? maybe you could collect the top-10 slowest.

javadoc of isStatisticsEnabled() states logged, I'm a bit confused on that; you mean that stats will be logged or collected?

ReplyQuote
 
21. Jun 2014, 16:11 CET | Link

Could it be true that its nearly unattainable a vehicle loan nowadays in case your credit is anything under perfect? This is actually the common perception with many people, however with the next poor credit vehicle financing tips, you may still obtain a loan with reasonable terms vehicle vehicle For those who have a low credit score history you might be thinking about you choices for poor credit finance. It might want to purchase a vehicle, or perhaps a home, but arent sure whether you will get the finance needed for that purchase. poor credit

 
17. Jul 2014, 19:28 CET | Link
Natural Crytsal x

Here Sell Natural Herbs to your sex organs. get the low price and high quality. guaranteed safe to use and has been selling certified immediately get Crystal x Asli

01. Aug 2014, 13:19 CET | Link

Includes a collection of Jon Hildebrandt Superhandles reviews, video download information, basketball drills and workouts, and tips on how to become a better basketball player from around the web.visit rebelmouse.com for super moves dribbling

 
29. Aug 2014, 06:11 CET | Link
obat herbal sinusitis

Click HELP for text formatting instructions. Then edit this text and check the preview. obat herbal sinusitis

 
10. Sep 2014, 13:03 CET | Link

Thanks for sharing more about it . I was searching for more on it .

 
19. Sep 2014, 00:40 CET | Link
heeba

My professor always salarys notice to grammar imperatives of my paper writings furthermore alternative stints. That's reason I comprehend that it isn't simple job to scratch an gorgeous essay. In your case capacity is veritable further intenersting.

 
26. Sep 2014, 09:31 CET | Link
obat wasir

Obat Wasir Paling Tepat Untuk Diminum Pencegahan Dengan Jus Kulit Manggis Obat Herbal Wasir. Proses penyembuhan terpercaya guna mencegah penyakit ambeien dengan menjaga tinja agar tetap elastis supaya dapat keluar dengan gampang, sehingga dapat mengurangi tekanan dan tegangan pada anus, selesaikan sesegera mungkin sehabis ada rangsangan buang air besar. obat wasir

 
29. Sep 2014, 04:45 CET | Link
darwin

Great post. Great work done. I am truly impressed by this marvelous piece of art work today. Writing an article is a brilliant art, my friend. And you've nailed that art! ejercicios para perder peso

 
02. Oct 2014, 14:26 CET | Link
jassica

Better yet, this product ships in a discreet package – no one will ever know what’s inside! (That is, until your significant other sees that massive erection of yours! sparxx rx

 
20. Oct 2014, 12:02 CET | Link
kuen

This is a great article thanks for sharing this informative information. HD mxf files conversion software mxf converter pdf conversion to Office pdf to word

 
11. Nov 2014, 18:16 CET | Link
jack

It was great to see the old printshop and everyone who cosmetic dentist fort pierce works there again. I am excited to see a printing business still operating and growing, great job guys

 
23. Nov 2014, 13:57 CET | Link
asad

This site is a leading resource for information about the Dr. James Ross Human Anatomy And Physiology Course PDF book that teaches you everything you need to know about anatomy and physiology right from home.https://www.rebelmouse.com/humananatomyandphysiologyguide

 
24. Nov 2014, 04:57 CET | Link

Permission to visit his website, hopefully more prosperous and successful ... Asam Lambung

Post Comment