-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
95 commits
Select commit
Hold shift + click to select a range
761543f
much more comprehensive perf test with analysis: ezmsg-perf
griffinmilsap 0722bc9
less aggressive test strategy
griffinmilsap d1fc6e3
slight refactor
griffinmilsap b884118
minor
griffinmilsap 6beb4ba
html analysis output; ai was a bust
griffinmilsap a661ce5
report tweaks
griffinmilsap 5464887
added test iters
griffinmilsap 460ca9d
more cmdline
griffinmilsap 173c096
changing sample_rate calculation
griffinmilsap d17a4fe
fix: n-clients = 0 is useful and works
griffinmilsap 01212d3
better support for msg_size = 0 and n_clients = 0
griffinmilsap 30234ae
also force_tcp on tcp_spread oops
griffinmilsap e8d1a3d
viztracer is useful for profiling
griffinmilsap a791365
fix for rare exception on system shutdown
griffinmilsap 17ff66d
Merge branch 'fix/incomplete-read' into feature/more-perf-tests
griffinmilsap 77e38e9
added median latency
griffinmilsap 4693d5c
added median latency to performance report
griffinmilsap e8f4994
try using time.time
griffinmilsap 59d2c59
fix: graphserver port no-longer lingers
griffinmilsap 79b4339
comments to self
griffinmilsap 77eca8b
write optimization for tcp and SHM
griffinmilsap 48ab00d
formatting
griffinmilsap 7761370
tcp write optimization
griffinmilsap 2e09d62
backend rework: channels
griffinmilsap bd53ad7
bugfixes
griffinmilsap e8bd0aa
test scripts
griffinmilsap 1d3948e
backpressure fixed
griffinmilsap 2fed32a
working on bugfixes
griffinmilsap 35f8a10
lots of bugfixes
griffinmilsap f4bb029
painful bugfixes
griffinmilsap 5ac957c
fixed intermittent failure of test_filter_key
griffinmilsap ef073b8
Fixed issue with message channels attempting to connect to canonical …
griffinmilsap afd64d8
fixed backpressure from pub
griffinmilsap 7347424
attach example was broken
griffinmilsap 3cb550b
working around niche race condition
griffinmilsap 6b9a6ee
addressed socket bind race condition on linux
griffinmilsap 6643d7c
comments to document REUSEADDR behavior
griffinmilsap 37506b7
explicit close of socket resource
griffinmilsap 7161403
disable nagles algorithm
griffinmilsap cb15e57
fixed race condition on channel registration
griffinmilsap 821c7e3
reverting buffer stride calculation change
griffinmilsap 6b12778
much more comprehensive perf test with analysis: ezmsg-perf
griffinmilsap bdd4052
less aggressive test strategy
griffinmilsap ae0fb5d
slight refactor
griffinmilsap e252849
minor
griffinmilsap 386461a
html analysis output; ai was a bust
griffinmilsap d01deb7
report tweaks
griffinmilsap 2792fa6
local comms with no tcp ack
griffinmilsap 07ad449
remove debug statement
griffinmilsap 380e3b0
bugfix: local backpressure
griffinmilsap b05096a
added test iters
griffinmilsap 50756f6
more cmdline
griffinmilsap 8823c61
changing sample_rate calculation
griffinmilsap de37916
bugfix: force_tcp on local channel causes backpressure
griffinmilsap d714d81
fix: n-clients = 0 is useful and works
griffinmilsap 4bfd958
better support for msg_size = 0 and n_clients = 0
griffinmilsap 4dac9f9
also force_tcp on tcp_spread oops
griffinmilsap 1e54cfc
tcp benchmarks un-necessarily hamstrung by extra TCP transmission to …
griffinmilsap e780e8a
viztracer is useful for profiling
griffinmilsap eab4cea
force_tcp bugfix
griffinmilsap 1d59244
bugfix for rare error on shutdown
griffinmilsap fdb89dc
hotpath optim
griffinmilsap 856802f
added median latency
griffinmilsap a77eaa8
added median latency to performance report
griffinmilsap a0490d9
try using time.time
griffinmilsap dbd48b1
more diagnostic test results in less time
griffinmilsap 7fcfaa8
early quit and test randomization
griffinmilsap fd876fe
Merge branch 'feature/more-perf-tests' into griff/working
griffinmilsap 2489c78
attempting to stabilize perf test results
griffinmilsap f3e2560
tests stabilized with median of means and num-buffers = 1
griffinmilsap f97186f
Merge branch 'feature/more-perf-tests' into griff/working
griffinmilsap c6b985f
further simplifying tests
griffinmilsap 35c3811
Merge branch 'feature/more-perf-tests' into griff/working
griffinmilsap b676e77
bugfix: shm race
griffinmilsap 7b7cdce
tweak to remove nonstandard handling of state vars
griffinmilsap de4080d
Merge branch 'feature/more-perf-tests' into griff/working
griffinmilsap 746b49e
implemented batch writes for stable perf testing with num_buffers > 1
griffinmilsap f000d94
Merge with dev
griffinmilsap af8ff47
fix shm closure
griffinmilsap 39d9cc5
revert batch write; eventually should implement proper flow control
griffinmilsap 603f8a4
addressed deadlocks on shutdown and proper shm deallocation
griffinmilsap c097b77
revert except clause
griffinmilsap 256231c
fixes #204
griffinmilsap 1e45811
refactor classes out of messagechannel
griffinmilsap 592233f
Added docstrings for Channel and ChannelManager
griffinmilsap 5ca5711
chore: ruff formatting
griffinmilsap b13f7de
added unit tests for new functionality
griffinmilsap 8ff0657
chore: ruff formatting
griffinmilsap 4d3f3d8
fix for python 3.10
griffinmilsap b0997f4
fix: windows perf tests
griffinmilsap 9f6f94a
update git-blame-ignore-revs with more ruff formatting
griffinmilsap 438b557
addressed review
griffinmilsap a21073e
updated docstring
griffinmilsap 6132479
Update tests/ez_test_utils.py
griffinmilsap 66bdd6d
Merge branch 'griff/working' of https://github.com/ezmsg-org/ezmsg in…
griffinmilsap File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import asyncio | ||
|
|
||
| import ezmsg.core as ez | ||
|
|
||
| PORT = 12345 | ||
| MAX_COUNT = 100 | ||
| TOPIC = "/TEST" | ||
|
|
||
|
|
||
| async def handle_pub(pub: ez.Publisher) -> None: | ||
| print("Publisher Task Launched") | ||
|
|
||
| count = 0 | ||
|
|
||
| while True: | ||
| await pub.broadcast(f"{count=}") | ||
| await asyncio.sleep(0.1) | ||
| count += 1 | ||
| if count >= MAX_COUNT: | ||
| break | ||
|
|
||
| print("Publisher Task Concluded") | ||
|
|
||
|
|
||
| async def handle_sub(sub: ez.Subscriber) -> None: | ||
| print("Subscriber Task Launched") | ||
|
|
||
| rx_count = 0 | ||
| while True: | ||
| async with sub.recv_zero_copy() as msg: | ||
| # Uncomment if you want to witness backpressure! | ||
| # await asyncio.sleep(0.15) | ||
| print(msg) | ||
|
|
||
| rx_count += 1 | ||
| if rx_count >= MAX_COUNT: | ||
| break | ||
|
|
||
| print("Subscriber Task Concluded") | ||
|
|
||
|
|
||
| async def host(host: str = "127.0.0.1"): | ||
| # Manually create a GraphServer | ||
| server = ez.GraphServer() | ||
| server.start((host, PORT)) | ||
|
|
||
| print(f"Created GraphServer @ {server.address}") | ||
|
|
||
| try: | ||
| test_pub = await ez.Publisher.create(TOPIC, (host, PORT), host=host) | ||
| test_sub1 = await ez.Subscriber.create(TOPIC, (host, PORT)) | ||
| test_sub2 = await ez.Subscriber.create(TOPIC, (host, PORT)) | ||
|
|
||
| await asyncio.sleep(1.0) | ||
|
|
||
| pub_task = asyncio.Task(handle_pub(test_pub)) | ||
| sub_task_1 = asyncio.Task(handle_sub(test_sub1)) | ||
| sub_task_2 = asyncio.Task(handle_sub(test_sub2)) | ||
|
|
||
| await asyncio.wait([pub_task, sub_task_1, sub_task_2]) | ||
|
|
||
| test_pub.close() | ||
| test_sub1.close() | ||
| test_sub2.close() | ||
|
|
||
| for future in asyncio.as_completed( | ||
| [ | ||
| test_pub.wait_closed(), | ||
| test_sub1.wait_closed(), | ||
| test_sub2.wait_closed(), | ||
| ] | ||
| ): | ||
| await future | ||
|
|
||
| finally: | ||
| server.stop() | ||
|
|
||
| print("Done") | ||
|
|
||
|
|
||
| async def attach_client(host: str = "127.0.0.1"): | ||
|
|
||
| sub = await ez.Subscriber.create(TOPIC, (host, PORT)) | ||
|
|
||
| try: | ||
| while True: | ||
| async with sub.recv_zero_copy() as msg: | ||
| # Uncomment if you want to see EXTREME backpressure! | ||
| # await asyncio.sleep(1.0) | ||
| print(msg) | ||
|
|
||
| except asyncio.CancelledError: | ||
| pass | ||
|
|
||
| finally: | ||
| sub.close() | ||
| await sub.wait_closed() | ||
| print("Detached") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| from dataclasses import dataclass | ||
| from argparse import ArgumentParser | ||
|
|
||
| parser = ArgumentParser() | ||
| parser.add_argument("--attach", action="store_true", help="attach to running graph") | ||
| parser.add_argument("--host", default="0.0.0.0", help="hostname for graphserver") | ||
|
|
||
| @dataclass | ||
| class Args: | ||
| attach: bool | ||
| host: str | ||
|
|
||
| args = Args(**vars(parser.parse_args())) | ||
|
|
||
| if args.attach: | ||
| asyncio.run(attach_client(host=args.host)) | ||
| else: | ||
| asyncio.run(host(host=args.host)) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.