Skip to content

Conversation

@tubignat
Copy link
Contributor

What changed?
Timer task queue now keeps incoming tasks in an in-memory queue until the next execution iteration

Why?
To reduce load on DB by avoiding agressively polling it for next timer tasks

How did you test it?
[WIP]

Potential risks
[WIP]

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're using pending task tracker to track all the pending tasks in-memory and uses this component to get the ack level of history queues. The in-memory tasks introduced in this PR are NOT tracked by that component, so it's possible that the ack level becomes larger than a pending task.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And RemoveScheduledTasksAfter should be implemented in a way that invokes Cancel method of task interface on tasks in pending task tracker.

ts := info.Tasks[i].GetVisibilityTimestamp()
if ts.Before(nextTime) {
nextTime = ts
readLevel := q.base.newVirtualSliceState.Range.InclusiveMinTaskKey.GetScheduledTime()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the current max read level. The current read level is in virtual slice component. If virtual queue is still trying to read tasks from the database, the task can be submitted twice.

@tubignat tubignat force-pushed the master branch 2 times, most recently from c98c02e to b89632f Compare October 21, 2025 07:58
@tubignat tubignat changed the title [WIP] Task Processing Optimization feature: [WIP] Task Processing Optimization Oct 21, 2025
@tubignat tubignat changed the title feature: [WIP] Task Processing Optimization feat: [WIP] Task Processing Optimization Oct 21, 2025
@tubignat tubignat force-pushed the master branch 2 times, most recently from 0b87db0 to 4c4f7de Compare October 21, 2025 10:19
Signed-off-by: Ignat Tubylov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants