=== modified file 'src/client_side.cc' --- src/client_side.cc 2013-05-08 03:02:01 +0000 +++ src/client_side.cc 2013-05-12 03:49:19 +0000 @@ -2935,14 +2935,22 @@ } } -static int +static bool connOkToAddRequest(ConnStateData * conn) { - int result = conn->getConcurrentRequestCount() < (Config.onoff.pipeline_prefetch ? 2 : 1); + const int maxReq = (Config.onoff.pipeline_prefetch ? SQUID_PIPELINE_MAX : 1); + const bool result = (conn->getConcurrentRequestCount() < maxReq); + + /* TODO: make this more dynamic? + * ... false / no pipeline for HTTP/1.0 clients? + * ... false if NTLM/Negotiate handshake is being done by the last parsed request + * ie, pipeline prefetch non-auth requests, halt during connection-auth, + * and resume pipeline prefetching after authed. + */ if (!result) { - debugs(33, 3, HERE << conn->clientConnection << " max concurrent requests reached"); - debugs(33, 5, HERE << conn->clientConnection << " defering new request until one is done"); + debugs(33, 3, conn->clientConnection << " max concurrent requests reached (" << maxReq << ")"); + debugs(33, 5, conn->clientConnection << " defering new request until one is done"); } return result; @@ -2970,7 +2978,7 @@ if (in.notYetUsed == 0) break; - /* Limit the number of concurrent requests to 2 */ + /* Limit the number of concurrent requests to SQUID_PIPELINE_MAX */ if (!connOkToAddRequest(this)) { break; } === modified file 'src/client_side.h' --- src/client_side.h 2013-04-04 06:15:00 +0000 +++ src/client_side.h 2013-05-12 03:33:35 +0000 @@ -175,10 +175,30 @@ class ServerBump; } #endif + +/** Maximum number of pipelined requests to pre-parse. + * + * Squid can pre-parse requests on a persistent connection and queue them for + * service while waiting for a leading transaction to complete. This value + * defines how many requests may be pre-parsed when pipeline_prefetch + * directive in squid.conf is set to ON and teh client is using a persistent + * connection. + * + * It is generally better to leave most pipelined requests in TCP buffers, + * which provides some push-back on the client sending rate. + * + * NP: currently limited to 2 in case there is any hidden code relying on that + * old hard-coded value still hanging around. + * May be set using -D in CXXFLAGS to test other values. + */ +#if !defined(SQUID_PIPELINE_MAX) +#define SQUID_PIPELINE_MAX 2 +#endif + /** * Manages a connection to a client. * - * Multiple requests (up to 2) can be pipelined. This object is responsible for managing + * Multiple requests (up to SQUID_PIPELINE_MAX) can be pipelined. This object is responsible for managing * which one is currently being fulfilled and what happens to the queue if the current one * causes the client connection to be closed early. *