开发者

Thinking Sphinx rebuilding index - high CPU load

开发者 https://www.devze.com 2023-03-09 02:03 出处:网络
I have a CRON job rebuilding Sphinx index every 5 minutes: */5 * * * * cd /var/www/my_app && /usr/local/bin/ruby /usr/local/bin/rake RAILS_ENV=production 开发者_开发知识库ts:rebuild>>

I have a CRON job rebuilding Sphinx index every 5 minutes:

*/5 * * * * cd /var/www/my_app && /usr/local/bin/ruby /usr/local/bin/rake RAILS_ENV=production 开发者_开发知识库ts:rebuild >> /var/www/my_app/log/cron_log.log

It's indexing only one table with around 400 records, but every time it starts the rake task the CPU load jumps to 100% (VPS with 4 CPUs and 1 GB RAM). I can't seem to find any reasonable explanation for this. How can I investigate what's causing it? Is there any way to optimize this process?


Does this task use the processes a great deal, and then stop as expected? Does it hang around far longer than it should?

Also, it's worth noting that you only need to rebuild if indices structures change (new fields or attributes), or you add or remove indices - to just update data, use the ts:index task instead (which doesn't restart Sphinx unnecessarily).

0

精彩评论

暂无评论...
验证码 换一张
取 消