How to handle a large stream that is mostly written to disk in netty (use ChunkedWriteHandler?)?

StackOverflow https://stackoverflow.com/questions/8421235

  •  29-10-2019
  •  | 
  •  

Question

I have a binary protocol with some unknown amount of initial header data (unknown length until header is fully decoded) followed by a stream of data that should be written to disk for later processing.

I have an implementation that decodes the header and then writes the file data to disk as it comes in from one or more frames in ChannelBuffers (so my handler subclasses FrameDecoder, and builds the message step by step, not waiting for one ChannelBuffer to contain the entire message, and writing the file data to disk with each frame). My concern is whether this is enough, or if using something like ChunkedWriteHandler does more than this and is necessary to handle large uploads.

Is there a more optimal way of handling file data than just writing it directly to disk from the ChannelBuffer with each frame?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top