-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support Unix domain sockets #35
Conversation
Thanks for the contribution! I will take a look right away. I assume that the motivation is doing IPC instead of a tcp socket over loopback to do away with the TCP overhead? I am curious about usecases in which this is a bottleneck. At a glance, I think we want to only listen to either a tcp or uds stream and backport those changes to |
The TCP vs UDS bottleneck was not a concern (although it's interesting that Linux has roughly 10ms latency overhead compared to macOS on its loopback device). I was writing integration tests with cometbft running as a child process and noticed that it supports This has a couple of advantages:
And then of course it's nice when you consider socket activation if someone wants to run cometbft + tower-abci app as a raw process on top of systemd rather than k8s. |
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.
Adding support for unix streams is a good idea, but I think we can simplify the implementation. If you give me access to the branch, I can implement the requested changes myself and cut a release shortly after.
I gave you write access to astriaorg/tower-abci. Hope that will allow you to push to the feature branch. |
I have tested that uds support works for both v034 and v037. By the way, we are planning to add gRPC support sometime this fall! |
Released in v0.10.0, thanks for your contribution! |
Thank you for merging this! |
Follow up to the addition of unix socket support [0], making that feature conditional on building for a target OS family of "unix" [1]. [0] #35 [1] https://doc.rust-lang.org/reference/conditional-compilation.html#target_family
Follow up to the addition of unix socket support [0], making that feature conditional on building for a target OS family of "unix" [1]. [0] #35 [1] https://doc.rust-lang.org/reference/conditional-compilation.html#target_family Co-authored-by: Conor Schaefer <conor@penumbralabs.xyz>
This patch allows the v037 server to serve cometbft connecting over unix domain sockets in addition to TCP.
Server::listen
no longer has a tcp socket addr as argument. Instead, TCP and UDS listeners are set onServerBuilder
. They are complimentary andServer
can serve requests over either or both protocols.If neither TCP nor UDS are set
ServerBuilder::finish
returnsNone
if neither are set. This seems in line with the current behavior ofServerBuilder
, but more expressive errors would be nice (but not in this PR).Note that when shuffling the code around I left the original commented out lines in place. Happy to remove them, but they probably serve a purpose.
Open question: should the v034 also support UDS?