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

feat: optimize queue usage for follow endpoints #6856

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Malaydewangan09
Copy link
Contributor

What changes are being made and why?

This PR introduces improvements to the follow endpoints for executions and logs in Kestra. It focuses on optimizing queue usage to enhance scalability and resource efficiency.

Key Changes:

Centralized Queue Management:

Implemented a singleton ExecutionStreamingService to manage a single queue consumer for all execution updates.
Reduces the creation of multiple queue consumers and threads for each connection.
Subscriber Pattern:

Introduced a subscription mechanism where clients (UI connections and wait=true executions) register as subscribers for specific execution IDs.
Updates are selectively broadcasted to relevant subscribers using a ConcurrentHashMap.

Addresses #6777

@loicmathieu
Copy link
Member

Hi @Malaydewangan09 this looks good at first look! Great implementation.
I'll review it next week or the week after and made adjustment if necessary as this is a very complex area and prone to memory leak (due to how SSE connections work).

Thank you.

@Malaydewangan09
Copy link
Contributor Author

Sure, @loicmathieu
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To review
Development

Successfully merging this pull request may close these issues.

2 participants