php - Lucene Search index breaks regularly on shared hosting when site has high volume of write access -


i have implemented lucene on website. once every 4 days search index breaks. error saying index unreadable , site shows 500 error users.

i ssh in, rebuild index , eveything goes normal.

the part of project different normal high number of writes doing db. incrementing viewcount field on every page view. presume lucene updates document every time.

presuming issue: there way tell lucene not update index when incrementing count field?

nb: project uses sfluceneplugin within symfony

nb2: error message similar to:

sep 03 18:52:21 symfony [err] {sfexception}  file '/home/username/symfony_project/data/index/myindex/en/_1nws_s.del' not readable.  in /home/username/symfony_project/plugins/sfluceneplugin/lib/vendor/zend/search/lucene/storage/file/filesystem.php  line 59 

are seeing messages in log files?

sep 03 18:52:21 symfony [err] {sfexception} file '/home/username/symfony_project/data/index/myindex/en/_1nws_s.del' not readable. in /home/username/symfony_project/plugins/sfluceneplugin/lib/vendor/zend/search/lucene/storage/file/filesystem.php line 59

if are, key point index being corrupted high number of files being open concurrently on server. limitation encountered on shared hosting, other users, if on different virtual servers, add lot of file reads/writes, webserving.

lucene creates new fragments of index each update, , on time means index spread on number of files, rather well-optimised index of 1 file. means likelihood of concurrency error increases on time badly-optimised index. optimising can help, can time-consuming large indexes , still @ risk of concurrency error, if it's lower probability.

the trick solving balance optimisation schedule using cronjob, , note, not update index trivial data changes (e.g. modified dates, view counts).

for latter point, create softupdate() method in each of model classes form part of index. create logic here discounts trivial column updates , not hook search-index updates of sfluceneplugin. now, not easy sounds sfluceneplugin uses propel behaviours run 'globally' objects...

the solution edit behaviour directly, or drop behaviour , write own methods update index. luckily, there example of functions required in symfony jobeet tutorial, day 17: http://www.symfony-project.org/jobeet/1_4/propel/en/17#chapter_17_sub_the_save_method

the downside here may end needing 'rebuild' indexing strategy you'd neatly formed in sfluceneplugin's yaml syntax in php... syntax not hard, complexity may be.

i hope makes sense, , helps in way.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -