-
Notifications
You must be signed in to change notification settings - Fork 9
Backend Rework: Message Channels #198
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
Conversation
|
Unit tests for TODO:
Additionally, it would be valuable to implement all of the I'd like all of this to be done before moving on to a separate PRs/enhancements for:
|
|
Okay, I think this is ready for merge into dev. @cboulay @KonradPilch lmk if you feel the same way and I'll merge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First, AMAZING work. Thanks @griffinmilsap.
Just leaving some comments, most are minor.
Very happy with the changes. If you think this is in a state you're happy with @griffinmilsap, I'd be ok with merging once you have looked at my comments and decided what does and doesn't need actioning.
Also @griffinmilsap, feel free to add an explanation of how the backend works now in the docs repo. I feel like the explanation you've provided in this PR is exactly what would work best there. If you want to move onto the list of further work you've got listed above, let me know and I can put the docs work on my todo instead. |
You are a gentleman and a scholar, huge thanks for looking over this absolutely massive PR. Going through your comments one by one now; thanks!!! |
Co-authored-by: Konrad Pilch <konradkpilch@gmail.com>
…to griff/working
KonradPilch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks good to me now!
Message Channel Backend Rework
Summary
This PR introduces a major rework of the ezmsg Pub/Sub backend, replacing the direct publisher→subscriber TCP link model with an intermediary Message Channel abstraction.
The new design substantially reduces redundant serialization between processes, improves fan-out efficiency, and introduces a unified point for telemetry, profiling, and performance tracking.
Motivation
In the current (
dev) branch of ezmsg:Example: Redundant Serialization (Current Backend)
flowchart LR subgraph ProcessA P[Publisher] end subgraph ProcessB S1[Subscriber 1] S2[Subscriber 2] end P -- "TCP Serialized Message #1" --> S1 P -- "TCP Serialized Message #2" --> S2This design scales poorly as the number of subscribers per process increases.
Solution: Message Channels
This PR introduces Message Channels, lightweight intermediaries that handle message fan-out and deserialization per process, not per subscriber.
ChannelRegistry(similar to the prior message cache) manages available channels and their endpoints.Optimized Flow (New Backend)
flowchart LR subgraph ProcessA P[Publisher] end subgraph ProcessB CH[Message Channel] S1[Subscriber 1] S2[Subscriber 2] end P -- "Serialized Once" --> CH CH -- "Shared Message" --> S1 CH -- "Shared Message" --> S2Benefits
Performance Validation
All benchmarks were executed on Apple Silicon (M3 Pro, 14 cores, 48 GB RAM) using Python 3.11.11 and ezmsg 3.6.2.
Metrics compare the new Message Channel backend (this PR) against the previous direct pub/sub backend (
devbranch).Highlights
Summary of Impact
References
feature/more-perf-tests