Raphael Jeger
Raphael Jeger

Reputation: 5222

Parallelizing browser requests

We have a situation where we only have one server/IP adress and several aliases, like:

127.0.0.1
s1.domain.com
s2.domain.com
s3.domain.com

How many parallel connections do browsers support to those aliases? Are they treated as one server because they share the same IP or are they treated as 3 because they have separate aliases?

We have done our tests and are pretty sure they are treated separately, but we'd like to understand the facts/theory behind that.

Upvotes: 0

Views: 168

Answers (1)

Bogdan
Bogdan

Reputation: 24580

How many parallel connections do browsers support to those aliases?

It depends on the browser.

When HTTP/1.1 was introduced with persistent connections enabled by default, the suggestion was that browsers open only two connections per hostname. Pages that had 10 or 20 resources served from a single hostname loaded slowly because the resources were downloaded two-at-a-time. Browsers have been increasing the number of connections opened per hostname, for example, IE went from 2 in IE7 to 6 in IE8. This test measures how many HTTP/1.1 connections are opened for the browser being tested.

The above is taken from the tool tip on the "Connections per Hostname" header column from the Browserscope site, "Network" tab. See also what's mentioned in the HTTP spec.

The distinction is made per hostname, not IP, so "s1.domain.com", "s2.domain.com" and "s3.domain.com" will be treated separately. At least that's the theory.

This is confirmed in a post by Steve Souders:

It’s important to understand that this is on a per server basis. Using multiple domain names, such as 1.mydomain.com, 2.mydomain.com, 3.mydomain.com, etc., allows a web developer to achieve a multiple of the per server connection limit. This works even if all the domain names are CNAMEs to the same IP address.

So you should expect around 6-8 parallel connections to a host. This is configurable per browser but increasing the number of parallel requests per hostname won't necessary mean faster load as a larger number of threads will add time with context switching and overhead while competing for limited resources (i.e. your CPU cores).

Upvotes: 1

Related Questions