Michael P
Michael P

Reputation: 2067

HTTP 2.0 vs HTTP 1.1 with connection pool on server to server communication

I've been reading about HTTP 2.0 recently and I'm trying to understand if there are any benefits for server to server (REST) communication. The scenario is server A sending REST Json messages to Server B (or a small number of Server 2 instances). Usually HTTP clients maintain connection pools and reuse old connections, so if the servers communication over HTTP 1.1 once the connection is established it will be reused. In that case what would be the benefit of HTTP 2.0? Also if server B tends to timeout a lot then with HTTP 1.1 the connections will have to be closed and opened again, which is an overhead. However with HTTP 2.0, wouldn't the situation be the same?

Upvotes: 4

Views: 1558

Answers (1)

sbordet
sbordet

Reputation: 18477

For a small number of servers, I don't think there will be a big difference between HTTP/1.1 and HTTP/2. I think the same goes for small request rates. The HTTP client in ServerA will need to open and pool a small number of connections, possibly just one, in both cases.

The scenario can be really different for a large number of servers (hundreds or more), or for high request rates, that would force HTTP/1.1 to open and maintain a large number of connections. This is where the multiplexing feature of HTTP/2 can really shine and give an edge to HTTP/2 over HTTP/1.1.

Lastly, when using HTTP/2 you also need to take into account request and response content sizes. Differently from HTTP/1.1, HTTP/2 enforces flow control at the protocol level, and this may stall uploads/downloads if the flow control windows are too small.
Fortunately, this should be configurable in good HTTP/2 client and server implementations.
For small content sizes, you should not see much interference of the flow control mechanism, so HTTP/2 should perform as well as HTTP/1.1.
For larger content sizes, you want to configure the flow control windows to larger values, to avoid that the flow control mechanism stalls the uploads/downloads too often.

Upvotes: 3

Related Questions