0

Does Netty 4(or 5) continue reading while the handler chain is invoked ? Like reading in the background and filling up a huge queue and processing all reads after the handler chain is completely ready ?

I'm asking because I want to save incoming buffers to a file but files are blocking and if there are more incoming messages than the hard drive can handle do those messages queue up or does blocking the event simply stops the event queue from reading more messages ? On the sending side I use FileRegion so flow control for the writer is given.

I looked into the source but I'm not entirely sure how those ChannelInvokers work, it seems that if no one is specified a default one is created using eventLoop.next().

Would be nice if someone could help me to make sure that I'm not introducing a potential flow control bug...

I saw the option setAutoRead but I'm pretty sure this does something different.

Michael Sanchez
  • 1,215
  • 1
  • 11
  • 19
Kr0e
  • 2,149
  • 2
  • 24
  • 40

1 Answers1

1

If you want to do something like this you should specify a custom DefaultEventExecutorGroup when adding the handler that writes to the FS. This way you will hand-over the work from the EventLoop and so not block anything here.

Norman Maurer
  • 23,104
  • 2
  • 33
  • 31
  • From a performance point of view you are right, but I would like to know if Netty keeps reading in the background while the event loop is blocked. The ChunkedWriteHandler does the same (blocking the event loop when writing the next chunk) and so does FileRegion, doesn't it ? But really, I'm only wondering if Netty keeps reading or not. – Kr0e Aug 15 '14 at 07:49
  • 1
    No it will not keep reading for the Channels that are assigned to the EventLoop. – Norman Maurer Aug 15 '14 at 09:42