How to terminate process with Lucene NRT Reader/ Writer gracefully? -



How to terminate process with Lucene NRT Reader/ Writer gracefully? -

we using lucene's near real-time search feature full-text search in our application. since commits costly, commit index after every 10 documents added (we expect around 150 200 documents per hr indexing). now, if want terminate process, how create sure documents in memory committed disk before process killed? there approach recommended here? or document volume less bother , should commit on every addition?

should track uncommitted documents? , if process gets killed before committed disk, should index these uncommitted ones 1 time again when process start up?

lucene nrt used in process runs embedded jetty. right approach send shutdown command (invoke servlet) jetty , wait till documents committed , terminate using system.exit()?

you add together hook commit buffered documents in destroy method of servlet , create sure embedded servlet container shut downwards before calling system.exit (maybe adding shutdown hook jvm).

but still not perfect. if process gets killed, buffered info lost. solution utilize soft commits. soft commits inexpensive commits (no fsync performed) no info lost if process gets killed (but info still lost if server shuts downwards unexpectedly).

to sum up:

shutdown hook best throughput data can lost if process gets killed soft commit no info lost if process gets killed data may lost if server shuts downwards unexpectedly hard commit (default) no info loss @ all slow (need perform fsync)

lucene lucene-nrt

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -