Bug 542401 - Look into whether Firefox should set TCP_NODELAY for non-SSL HTTP socket r=jduell

indeed without nagle disabled (which is what nodelay does) a pipeline
can be interrupted for a full rtt waiting for an ack, which defeats
the purpose of pipelining. Other parts of FF can just coalesce the
writes internally, but sometimes that is not possible for pipelines
which may not have an opportunity for a pipelined request when the
"runt" packet goes out, but discovers such an opportunity a long time
before the rtt is expired. In other places (such as long posts) we do
a fine job of coalescing already, so this should not result in any
extra packets on the wire, just improved latency.

--HG--
extra : rebase_source : f83f5b080a3da5875abaee001e8af18503fcff38
This commit is contained in:
Patrick McManus 2011-03-23 11:03:09 -04:00
Родитель 2c0ac326b8
Коммит 748b83231a
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -1131,6 +1131,13 @@ nsSocketTransport::InitiateSocket()
status = PR_SetSocketOption(fd, &opt); status = PR_SetSocketOption(fd, &opt);
NS_ASSERTION(status == PR_SUCCESS, "unable to make socket non-blocking"); NS_ASSERTION(status == PR_SUCCESS, "unable to make socket non-blocking");
// disable the nagle algorithm - if we rely on it to coalesce writes into
// full packets the final packet of a multi segment POST/PUT or pipeline
// sequence is delayed a full rtt
opt.option = PR_SockOpt_NoDelay;
opt.value.no_delay = PR_TRUE;
PR_SetSocketOption(fd, &opt);
// if the network.tcp.sendbuffer preference is set, use it to size SO_SNDBUF // if the network.tcp.sendbuffer preference is set, use it to size SO_SNDBUF
// The Windows default of 8KB is too small and as of vista sp1, autotuning // The Windows default of 8KB is too small and as of vista sp1, autotuning
// only applies to receive window // only applies to receive window