Web standards and best practices are constantly shifting. In our efforts to maintain the highest level of quality in a changing landscape, imgix periodically deprecates features that are obsolete or even potentially detrimental. In this vein, we will be deprecating and removing domain sharding from all of our core libraries, a process we expect to complete by the end of May.
What is Domain Sharding?
Domain sharding is a practice that developed in response to the limits of web browsers using HTTP/1.1. To circumvent browser restrictions on the number of open connections, developers would split their files across multiple subdomains. This move allowed them to use more parallel connections, resulting in faster page load times.
Because of its status as a popular practice, domain sharding has been a feature of many of imgix's core SDK libraries since their initial development. Specifically, it has been supported in our Ruby, PHP, Java, Node.js, Python, C#, and Go libraries.
Drawbacks of Domain Sharding
There comes a point at which domain sharding results in more performance costs than gains. Web browsers must perform DNS lookups for each additional subdomain, as well as maintain connections across the subdomains. If done without extreme care, domain sharding can also result in a less efficient user experience (and, possibly, higher imgix bills). If, for example, numerous image requests are distributed over different subdomains, it’s easy for simple actions like adding, removing, or rearranging images on a page (not to mention adding or removing a subdomain) to create new image paths for existing images. Any such change in image paths circumvents multiple layers of caching, from imgix's painters to the CDN to the end user's browser, and results in wasted bandwidth and slower load times.
In addition, on a low-powered device such as a mobile phone, domain sharding can be especially ineffective. On a mobile network, the transfer of data can be quite fast, but establishing connections over a mobile network is relatively slow. In this case, maximizing parallel downloads is actually counterproductive.
HTTP/2 and a New Landscape
In 2016, HTTP/2 arrived with a key feature. The protocol allows multiplexing — the ability for a single TCP connection to handle multiple requests concurrently, rather than sequentially. Browsers using HTTP/2 no longer enforce connection limits. Under this protocol, domain sharding offers no benefits, and in fact prevents multiplexing from being used to its fullest potential. imgix has supported HTTP/2 fully for all customers since January 2017.
How Will This Affect Your End User?
All modern versions of the major browsers now support HTTP/2, which accounts for 96% of desktop users and 88% of mobile users globally. If that second number sounds worrisome, remember that domain sharding is discouraged for mobile devices anyway.
For the reasons explained above, domain sharding is no longer a best practice for the vast majority of users. As such, we've decided to deprecate and remove the domain sharding feature from the next major version of each of imgix's core SDK libraries. Note that the removal of this feature will not prevent images from being served to any users, even those edge-case users on browsers that do not yet support the HTTP/2 standard.
We welcome your questions or concerns around this change. Please do not hesitate to write us at email@example.com.