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

Send batches over channels #2370

Merged
merged 2 commits into from
Oct 12, 2020
Merged

Conversation

EVODelavega
Copy link
Contributor

The core often sends events to the broker as a batch (e.g. settlements or trades). Optional subscribers (like the ones used for the event stream) rely on an internal channel to receive these events one by one. If we send a batch of trade events to the subscriber, this means the broker will iterate over each event trying to send each trade event one by one. This may seem harmless at first, but if there's a lot of streams open, especially if some of them are behind (ie the internal channel buffer is full), this leads to a lot of overhead, increase CPU usage, and actual data/events making it out to the subscribers slower and slower. With this change, batched events from the core make their way to the subscribers as a batch, and do so quickly (as fast as a single event). How the subscribers process the individual events from that point on is less of a concern to the core/broker, and doesn't impact performance as much.

@EVODelavega EVODelavega merged commit b5793f0 into develop Oct 12, 2020
@EVODelavega EVODelavega deleted the feature/batch-subscriber-channels branch October 12, 2020 09:10
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