java - How to configure Netty to have a single worker thread? -
let's assume we're implementing service accesses shared data, , there no way of partitioning data portions can accessed independently. reason, not more 1 single thread can read/write data @ given time.
a correct, although inefficient way solve use synchronization technique (semaphores, monitors etc.), netty worker threads don't corrupt shared data accessing @ same time (when servicing requests). however, whole locking/unlocking degrade performance huge amount.
so, first question is:
how configure netty have single worker thread?
and second is:
what design solve problem of having shared data access cannot done more 1 thread @ given time?
the 1-worker solution seems solve problem, wonder how hurt netty's performance, since there might tens of thousands of clients connected @ same time, sending requests , waiting replies...
- give socketfactory single threaded executor, or
- put shared , executionhandler single threaded executor in pipeline
Comments
Post a Comment