Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch requests to flush context to backend #320

Merged
merged 3 commits into from
Feb 14, 2025
Merged

Conversation

knolleary
Copy link
Member

Closes #319

Description

Currently the persistent context flush logic sends requests to the backend for all scopes that needed flushing without any regard of how many requests that would be.

Given the file server has to do locking on the database to properly calculate quotas for each request, flooding the backend with lots of requests causes a performance issue.

I have a test flow with 60 copies of a subflow that just writes a timestamp to its flow context - all wired to one inject node.

When triggered and the cache flushes, I see all 60 http requests made to the backend at the same time. The response time for each request increases markedly - the last few requests are close to 2000ms response time. With a single subflow, the response time is ~20ms. The response time increases the more subflow instances in the flow.

With this fix, the flush requests are made in batches of 5. The response time for each request remains stable at sub-30ms - the total time to flush is less with the batching in place than without.

@knolleary knolleary changed the title 319 flush batching Batch requests to flush context to backend Feb 14, 2025
@knolleary knolleary requested a review from hardillb February 14, 2025 16:24
@hardillb hardillb merged commit 92f852a into main Feb 14, 2025
5 checks passed
@hardillb hardillb deleted the 319-flush-batching branch February 14, 2025 16:31
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.

Add throttling to persistent storage cache flush
2 participants