vendredi 14 février 2020

Frequently polls happening from delayed job

Hi I am using delayed job active record gem in my production application with Postgres, a lot of background jobs are working through the delayed job

One thing I have noticed in the output of pg:outliers in our production database, the prop_exec_time is 4.5% for this query and almost 1.8 million calls happened in 45 hours.

Query:

UPDATE "delayed_jobs" SET locked_at = $1, locked_by = $2 WHERE id IN (SELECT id FROM "delayed_jobs" WHERE ((run_at <= $3 AND (locked_at IS NULL OR locked_at < $4) OR locked_by = $5) AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT $6 FOR UPDATE) RETURNING *

As per the delayed job, the polls happen every 5 seconds by default, but this happens even if there is no job to perform. Currently, there is no extra configuration in our app.

I guess I can override the default time of delayed_job, will this make any impact? Any kind of suggestion to reduce the calls

Aucun commentaire:

Enregistrer un commentaire