NOTE
NIO Event-Loop Server
A selector/event-loop server architecture and the separation of I/O readiness from application work.
This is a historical learning note and may contain outdated or incomplete understanding.
A NIO event loop uses a selector to multiplex accept/read/write readiness across many channels.
Keep the loop non-blocking: expensive parsing/business/database work should not stall readiness handling. If work is offloaded to workers, define queue bounds and a way to apply backpressure to the connection.
Maintain per-connection decoder/output state because reads and writes can be partial. Frameworks such as Netty package these concerns into a richer event-loop/pipeline model.