Поделиться через


System.Net.HttpWebRequest & pipelining

The System.Net.HttpWebRequest class in the .Net Framework implements a HTTP stack in managed code. One of the features of the stack is that it supports HTTP pipelining. Pipelining is the ability for an HTTP client application to send multiple requests on a connection before the server responds to the first request. Wikipedia describes pipelining here: https://en.wikipedia.org/wiki/HTTP_pipelining

This post is to give seasoned users of the HttpWebRequest class a heads up about a design change in the way we handle pipelining in version 2.0 of the .Net Framework. In 2.0 we throttle pipelined requests as follows:

If the number of sent pipelined requests reaches 10, no more requests will be written to the server (pipeline “paused”). When the number of written pipelined requests drops to 5 or less, because of processed responses, more requests will be written to the server if possible (pipeline “unpaused”). Of course all the other factors influencing pipeline-ability are still considered. The values of 10 and 5 noted above are not configurable by the developer. This throttling mechanism was introduced so as to not overwhelm servers after a number of requests are queued up on the server side.

Comments