Hi folks,

I found writing messages very fast from many threads sometimes doesn't
scale because the internal implementation of Seletor.wakeup() acquires
an exclusive lock.  We could minimize the wakeup() calls in
SocketIoProcessor.flush(), but I don't have any good idea to do so.

I thought about improving SocketIoProcessor.flush() like the following,

   void flush(SocketSessionImpl session) {
       boolean needsWakeup = flushingSessions.isEmpty();
       scheduleFlush(session);
       if (needsWakeup) {
           Selector selector = this.selector;
           if (selector != null) {
               selector.wakeup();
           }
       }
   }

but I doubt it might not wake the selector up when it needs to be waken up.

Any good idea?

Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to