Hi all,
I have a web app running Hibernate 3.5.1 and Search 3.2.0. I had similar problems with Hibernate 3.3.1 and Search 3.3.1, however, upgrading hasn't fixed the problem. I only get this problem on my VPS box, at the hosting company, my local installation seems fine. My question is about how to enable better logging to help investigate. I use java.util.logging, and Hibernate Search seems to do so also (via commons-logging?) yet I don't see enough information to solve my problem.
I'm running on test data, there are only about 10 objects being updated in this operation (there are only about 20 objects in total in the entire database). I've tried deleting my entire index directory, re-indexing my database, and running the operation again, same result. So, I don't think my index is stuffed with old or otherwise incorrect data.
The problem is that updating my objects, which are stored in a MySQL database, persisted by Hibernate, and indexed by Hibernate Search to a local FSDirectoryProvider, is very slow. I've tracked it down to something in the Hibernate Search indexing operations, while a transaction is being committed.
My code does the usual:
- start a session
- start a transaction
- load objects using a Criteria query
- modify some objects
- commit the transaction
- close the session
When the 'commit the transaction' step is reached, there is a significant pause between the call to close the transaction, and the call to close the session, and turning on java.util.logging levels for hibernate search shows it's probably something in the indexing operation:
Code:
15-May-2010 09:49:49 ltd.myapp.Brains interpretMessage
FINE: processMessage: committing active transaction.
15-May-2010 09:49:49 ltd.myapp.db.dbcp.DBCPConnectionProvider logStatistics
INFO: active: 0 (max: 15) idle: 2(max: 8)
15-May-2010 09:49:49 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor run
FINE: Opening an IndexWriter for update
15-May-2010 09:49:49 org.hibernate.search.backend.impl.lucene.PerDPQueueProcessor run
FINE: Opening an IndexWriter for update
15-May-2010 09:49:53 ltd.myapp.Brains interpretMessage
FINE: processMessage closing session.
15-May-2010 09:49:53 ltd.myapp.Brains interpretMessage
FINER: processMessage session closed.
15-May-2010 09:49:53 ltd.myapp.MyService processMessage
FINER: MyService saw interpretMessage returned.
15-May-2010 09:49:53 ltd.myapp.MyService _ctl
FINE: ****** RETURN SERVICE MESSAGE: uid 3, messageClass: subscribeToNotification
15-May-2010 09:49:53 ltd.myapp.MyService _ctl
INFO: TIMING subscribeToNotification took (4730) ms
After the PerDPQueueProcessor line of "Openening an IndexWriter for update" there's a 4 second pause, leading to my simple data update request to take 4.7 seconds in total. The pause is sometimes greater, leading to operations of up to 15 seconds for fairly trivial updates.
My indexes are stored in a local filesystem, in /var/lucene/indexes. It's not NFS mounted or otherwise (according to 'mount'), I can't see why file system access would be degrading performance.
My logging.properties file contains:
Quote:
org.hibernate.search.level = FINE
org.apache.lucene.level = FINE
I tried turning on some config in hibernate.cfg.xml:
Code:
<property name="hibernate.search.worker.execution">sync</property>
<property name="hibernate.search.default.optimizer.transaction_limit.max">100</property>
I also found a post on this forum telling me to try something like this:
Code:
<property name="log4j.logger.org.hibernate.search.backend.impl.lucene.works.AddWorkDelegate">trace</property>
However, this doesn't work, I see no extra logging.. I don't use log4j in my project, should I provide a log4j.xml file with any specific setup to debug Hibernate Search?
What should I do to further investigate the slow indexing operation? I've a feeling that extra logging may help, I just don't see how to turn it on.
Thanks :)
Nick