Added comments about optimizations that may be included as part of

fixing 423974 - Optimize flow control.
This commit is contained in:
Simone Bordet 2013-12-13 13:39:28 +01:00
parent 6f316f9887
commit ce4e07f6a4
2 changed files with 24 additions and 0 deletions

View File

@ -203,6 +203,16 @@ public class Flusher
if (controller != null)
controller.write(flusherCB, buffers);
// TODO: optimization
// If the callback completely immediately, it means that
// the connection is not congested, and therefore we can
// write more data without blocking.
// Therefore we should check this condition and increase
// the write window, which means to things: autotune the
// MAX_GATHER parameter, and/or autotune the buffer returned
// by FrameBytes.getByteBuffer() (see also comment there).
return State.SCHEDULED;
}

View File

@ -1163,6 +1163,20 @@ public class StandardSession implements ISession, Parser.Listener, Dumpable
IStream stream = getStream();
int windowSize = stream.getWindowSize();
// TODO: optimization
// Right now, we use the windowSize to chunk big buffers.
// However, if the window size is large, we may congest the
// connection, or favor one stream that does a big download,
// starving the other streams.
// Also, SPDY DATA frames have a maximum of 16 MiB size, which
// is not enforced here.
// We should have a configurable "preferredDataFrameSize"
// (or even better autotuning) that will allow to send chunks
// that will not starve other streams and small enough to
// not congest the connection, while avoiding to send too many
// TCP packets.
// See also comment in class Flusher.
size = dataInfo.available();
if (size > windowSize)
size = windowSize;