This class accepts a Node.js Readable stream as input, and keeps reading data
from the stream into the internal buffer structure, until it reaches maxBuffers.
Every available buffer will try to trigger outgoingHandler.
The internal buffer structure includes an incoming buffer array, and a outgoing
buffer array. The incoming buffer array includes the "empty" buffers can be filled
with new incoming data. The outgoing array includes the filled buffers to be
handled by outgoingHandler. Every above buffer size is defined by parameter bufferSize.
Input stream highWaterMark is better to set a same value with bufferSize
parameter, which will avoid Buffer.concat() operations.
Concurrency should set a smaller value than maxBuffers, which is helpful to
reduce the possibility when a outgoing handler waits for the stream data.
in this situation, outgoing handlers are blocked.
Outgoing queue shouldn't be empty.
This class accepts a Node.js Readable stream as input, and keeps reading data from the stream into the internal buffer structure, until it reaches maxBuffers. Every available buffer will try to trigger outgoingHandler.
The internal buffer structure includes an incoming buffer array, and a outgoing buffer array. The incoming buffer array includes the "empty" buffers can be filled with new incoming data. The outgoing array includes the filled buffers to be handled by outgoingHandler. Every above buffer size is defined by parameter bufferSize.
NUM_OF_ALL_BUFFERS = BUFFERS_IN_INCOMING + BUFFERS_IN_OUTGOING + BUFFERS_UNDER_HANDLING
NUM_OF_ALL_BUFFERS <= maxBuffers
PERFORMANCE IMPROVEMENT TIPS:
BufferScheduler