---
title: 'Saving ubuntu.com on download day: Caching location specific pages'
description: On release day we can get up to 8,000 requests a second to ubuntu.com
  from people trying to download the new release. In fact, last October (13.10) was
  the first release day in a long time that the site didn’t crash under the load at
  some point during the day (huge credit to the infrastructure  […]
url: https://canonical.com/blog/saving-ubuntu-com-on-download-day-caching-location-specific-pages
---

1. [Blog](https://canonical.com/blog)
2. Article

---

[Robin Winslow](https://canonical.com/blog/author/nottrobin "More about Robin Winslow")

28 August 2014

# Saving ubuntu.com on download day: Caching location specific pages

[Design](https://canonical.com/blog/tag/design)
[developers](https://canonical.com/blog/tag/developers)
[recent work](https://canonical.com/blog/tag/recent-work)
[Release](https://canonical.com/blog/tag/release)
[Ubuntu](https://canonical.com/blog/tag/ubuntu)

---

Share the article

On release day we can get up to 8,000 requests a second to [ubuntu.com](http://ubuntu.com) from people trying to download the new release. In fact, last October ([13.10](http://en.wikipedia.org/wiki/Ubuntu_13.10_Saucy_Salamander#Ubuntu_13.10_.28Saucy_Salamander.29)) was the first release day in a long time that the site didn’t crash under the load at some point during the day (huge credit to the [infrastructure team](http://www.ubuntu.com/management/ubuntu-advantage)).

Ubuntu.com has been running on [Drupal](http://drupal.org), but we’ve been gradually migrating it to a more bespoke [Django](http://django.org) based system. In March we started work on migrating the download section in time for the release of [Trusty Tahr](http://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Ubuntu_14.04_LTS_.28Trusty_Tahr.29). This was a prime opportunity to look for ways to reduce some of the load on the servers.

## Choosing [geolocated](http://en.wikipedia.org/wiki/Geolocation) download mirrors is hard work for an application

When someone downloads Ubuntu from ubuntu.com (on [a thank-you page](http://www.ubuntu.com/download/desktop/thank-you?version=14.04.1&architecture=amd64)), they are actually sent to one of the [300 or so mirror sites](https://launchpad.net/ubuntu/+cdmirrors) that’s [nearby](http://en.wikipedia.org/wiki/Geolocation).

To pick a mirror for the user, the [application](https://en.wikipedia.org/wiki/Web_application) has to:

1. Decide from the client’s [IP address](http://en.wikipedia.org/wiki/Ip_address) what country they’re in
2. Get the list of mirrors and find the ones that are in their country
3. Randomly pick them a mirror, while sending more people to mirrors with higher bandwidth

This process is by far the most intensive operation on the whole site, not because these tasks are particularly complicated in themselves, but because this needs to be done for each and every user – potentially 8,000 a second while every other page on the site can be aggressively [cached](https://en.wikipedia.org/wiki/Cache_(computing)) to prevent most requests from hitting the application itself.

For the site to be able to handle this load, we’d need to [load-balance](https://en.wikipedia.org/wiki/Load_balancing_(computing)) requests across perhaps 40 [VMs](https://en.wikipedia.org/wiki/Virtual_machine).

## Can everything be done client-side?

Our first thought was to embed the entire mirror list in the [thank-you page](http://ubuntu.com/download/desktop/thank-you) and use [JavaScript](http://en.wikipedia.org/wiki/Javascript) in the users’ browsers to select an appropriate mirror. This would drastically reduce the load on the application, because the download page would then be effectively [static](http://en.wikipedia.org/wiki/Static_web_page) and cache-able like every other page.

The only way to reliably get the user’s location [client-side](http://en.wikipedia.org/wiki/Client-side_scripting) is with the [geolocation API](https://developer.mozilla.org/en/docs/WebAPI/Using_geolocation), which [is only supported by 85% of users’ browsers](http://caniuse.com/#search=geolocation). Another slight issue is that the user has to give permission before they could be assigned a mirror, which would slightly hinder their experience.

This solution would inconvenience users just a bit too much. So we found a trade-off:

## A mixed solution – Apache geolocation

[mod\_geoip2](http://dev.maxmind.com/geoip/legacy/mod_geoip2/) for Apache can apply server rules based on a user’s location and is much faster than doing geolocation at the application level. This means that we can use Apache to send users to a country-specific version of the download page (e.g. [the German desktop thank-you page](http://www.ubuntu.com/download/desktop/thank-you?country=DE&version=12.04.4&architecture=amd64)) by adding `&country=GB` to the end of the URL.

These country specific pages contain the list of mirrors for that country, and each one can now be cached, vastly reducing the load on the server. Client-side JavaScript randomly selects a mirror for the user, weighted by the bandwidth of each mirror, and kicks off their download, without the need for client-side geolocation support.

This solution was successfully implemented shortly before the release of [Trusty Tahr](http://en.wikipedia.org/wiki/List_of_Ubuntu_releases#Ubuntu_14.04_LTS_.28Trusty_Tahr.29).

(This article was [also posted on robinwinslow.co.uk](https://robinwinslow.co.uk/2014/08/29/saving-ubuntu-com-download-day/))

[Get in touch

Interested in running Ubuntu in your organization?](https://ubuntu.com/about/contact-us/form)

## Sign up for our newsletter

Get the latest Canonical news and updates in your inbox.

Work email:

\*I agree to receive information about Canonical's
products and services.

In submitting this form, I confirm that I have read and agree to
[Canonical's Privacy Notice](https://canonical.com/legal/data-privacy/contact)
and [Privacy Policy](https://canonical.com/legal/data-privacy).

Sign up

## Share on

---

## Related posts

[### Canonical announces the alpha release of Charmed OpenShell to help secure autonomous AI agent fleets](https://canonical.com/blog/charmed-openshell-alpha-release)

To streamline enterprise deployment and lifecycle management, Canonical is announcing the alpha release of Charmed OpenShell.

[Canonical](https://canonical.com/blog/author/canonical)

28 September 2026

[### Ubuntu coming soon to Snapdragon X2 Series platforms, unlocking more Linux PCs for the agentic world](https://canonical.com/blog/ubuntu-coming-soon-to-qualcomm-snapdragon-x2-series-platforms)

Canonical and Qualcomm Technologies announce upcoming native Ubuntu support for Qualcomm’s flagship laptop silicon, delivering multi-day battery life, 80 TOPS NPU acceleration,...

[Canonical](https://canonical.com/blog/author/canonical)

23 September 2026

[### Arduino® VENTUNO™ Q is available for pre-order with Ubuntu pre-installed](https://canonical.com/blog/arduino-ventuno-q-is-available-for-pre-order-with-ubuntu-pre-installed)

London, UK – August 25, 2026 – Following our initial collaboration announcement in March 2026, Canonical and Arduino (a subsidiary of Qualcomm Technologies, Inc.) are excited...

[Canonical](https://canonical.com/blog/author/canonical)

25 August 2026

[### Canonical becomes Gold Sponsor of Trifecta Tech Foundation](https://canonical.com/blog/canonical-becomes-gold-sponsor-of-trifecta-tech-foundation)

Canonical is pleased to announce it is now a Gold Sponsor of the Trifecta Tech Foundation, a non-profit that creates open source building blocks for critical infrastructure...

[Canonical](https://canonical.com/blog/author/canonical)

30 June 2026
