Martin
Martin

Reputation: 371

Performance of Resque jobs

My Resque job basically takes params hash and stores it into the DB. In the process it does several reads and writes.

These R/Ws take approx. 5ms in total on my local machine and a little bit more on Heroku (I guess it's because of the shared DB).

However, the rate at which the queue is processed is very low / about 2-3 jobs per second. What could be causing this?

Thank you.

Upvotes: 0

Views: 581

Answers (1)

Douglas F Shearer
Douglas F Shearer

Reputation: 26528

Check for a new job, lock a job, do the job, mark it as completed, look for a new job.

You might find that the negotiation to get a new job, accessing Redis etc is causing a lot of overhead. If your task is only 5ms long, it can probably live inside the request-response cycle. Background jobs are great when running a task would extend the response time considerably, very small jobs generally aren't worth the effort involved.

Upvotes: 1

Related Questions