Sometimes pods take tasks slower than usually #669
nicolask1992
started this conversation in
General
Replies: 1 comment
-
Not exactly sure what is happening in your case, but running multiple schedulers with different task-lists against the same table is outside intended use. You should setup different tables for that case (though might not be straight-forward using the spring boot starter). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello @kagkarlsson, how are you?
At the company I work for, we decided to adopt your library and are very pleased with the results. However, we occasionally run into some issues.
At specific times of the day, we experience spikes in tasks (between 8 and 10 AM and between 5 and 7 PM), and sometimes (approximately once a week) the processing becomes slow, with the only remedy being a redeployment of the application.
For additional context, our company uses four types of workers/pods to process different kinds of tasks.
Upon reviewing the pods’ logs, we didn’t find anything unusual except for one query that appears most frequently when the problem occurs:
SELECT * FROM scheduled_tasks WHERE picked = ? AND execution_time <= ? AND task_name NOT IN (...) ORDER BY execution_time ASC LIMIT ?
For example, one complete query looks like this:
select * from scheduled_tasks where picked = 0 and execution_time <= '2025-03-24 08:49:53.184045' and task_name not in ('generica....','periodica....','generica....','periodica....','generica....','generica....','periodica....','generica....','generica...','generica....','registrotiempo....','periodica....','periodica....','periodica....','generica....') order by execution_time asc LIMIT 15
Here, “periodica”, “generica”, and “registrotiempo” represent the different workers that process the tasks. I’m not sure if using a NOT IN clause for these tasks is appropriate, but what is strange is that when this query appears at the top of our database, it's because we're in trouble.
I wanted to ask if you have any idea what might be causing this behavior. We have considered that it could be due to database session limits, or perhaps the default values for pollUsingFetchAndLockOnExecute (Defaults: 0, 5, 3.0) might not be optimal for our situation.
To provide further context, between 8 and 10 AM, 200,000 tasks are created (Instant.NOW()), with the peak occurring around 9 AM. The average execution time for each task is 60 ms.
After a redeploy the tasks are executed very fast
Here are some relevant implementation details:
build.gradle
compile group: 'com.github.kagkarlsson', name: 'db-scheduler-spring-boot-starter', version: '13.0.0'
Thanks in advance
Nicolas Kloster
Beta Was this translation helpful? Give feedback.
All reactions