Jeshua Lacock
Jeshua Lacock

Reputation: 6668

Clarify httpMaximumConnectionsPerHost when using httpShouldUsePipelining

I am using URLSession with MapKit. It has to download tiles for the screen for several different layers, so it could easily need to send 50 requests per screen.

My content server supports HTTP/2 and HTTP/3 so I have httpShouldUsePipelining to true.

My question is, when using httpMaximumConnectionsPerHost with httpShouldUsePipelining enabled on a HTTP/3 server, does each asset that needs to be downloaded count as a connection per host, or since multiplex is enabled and supported, does every asset request count as a single connection?

In other words, for handling say 50 requests with pipelining, would the httpMaximumConnectionsPerHost need to be 50 or 1? I don't want to drown the server in sessions or requests, so just trying to figure out what is likely to be optimal.

What happens if MapKit requests 50 assets, but then the screen view changes and requests another 50 assets before the first are downloaded. In that case, would it be using 2 connections? Or 100 multiplexed requests overy 1 connection?

This is how I am configuring my session:

let config = URLSessionConfiguration.default
config.httpShouldUsePipelining = true
config.httpMaximumConnectionsPerHost = 36
config.networkServiceType = .responsiveData
urlSession = URLSession(configuration: config)

Upvotes: 1

Views: 18

Answers (0)

Related Questions