Please support polling from a single non-Netty application thread? #13968
Unanswered
gordonbuntting
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Currently you can tweak your own |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What I would like to do is build our low-latency financial trading application with a single busy-spinning thread. It needs to perform various tasks as work is available including polling on network channels. Other middleware such as Aeron and Chronicle Queue support this. However we also need to consume and publish data to other protcols like TCP, HTTP and WebSocket at which Netty excels.
With a single-threaded application, there's no need to for thread-safe datastructures, lock-free techniques or thread-handoff which radically simplifies development and supports low-latency applications. Low Latency means aiming for response times in single digit microseconds @ 99%+.
Netty promises a Highly customizable thread model. However this seems to have an ironclad assumption that threads are owned by Netty. So even if I provided an
Executor
implementation that is serviced by the single application thread, a quick look at all the Netty implementations shows thatSingleThreadEventExecutor#run
is expected to block indefinitely until shutdown.Would you consider a poll method on these Executors that could be invoked from outside? And implementations would use either
selectNow
or have an upper limit? Of course it might not be that simple as any logic that currently blocks or has state in therun()
method would need to be refactored.Perhaps this would also be a better avenue to explore than Virtual Threads - which don't seem to promise much control of which platform thread tasks are run on AFAIK.
Any comments greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions