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?