Support listen on unix domain socket #231
Merged
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.
This feature is supported by uWebSockets.js via listen_unix(), so I figured I would submit this PR to add it to hyper-express, since I need to listen on unix domain sockets for my use case.
In my environment, hyper-express listening on a tcp port achieves 27,178 req/s, but listening on the unix domain socket achieves 47,088 req/s, which surpasses both hono and elysia bun frameworks when they're also listening on a unix domain socket. I tested using both oha and autocannon, and while the specific req/s numbers were different, the % change was still there.
Part of the large performance difference for my environment might be due to my sysctl tcp configuration, but regardless, socket file communication should always be faster than tcp port, as there is less overhead.
Are you able to run some benchmarks as well in your environment to see what performance difference you see?