The Guardian is an independent publisher and one of the most influential media companies in the world, informing nearly 100 million unique visitors per month. In 2011, the company adopted a “digital first” strategy, and by the next year the Guardian website had been ranked the third largest news site in the world. Based in the UK, the Guardian has also launched native properties in the US (where traffic has grown 55% year over year) and Australia.
The Guardian wanted control over their application and increased visibility into site traffic and performance. The company needed the freedom to self-provision services and fine-tune in real time. They were also looking for a CDN that would keep pace with their quick development cycle, providing rapid scalability and reliable performance for breaking news updates.
The Guardian considers Fastly a critical tool for real-time journalism. When major news breaks and the Guardian needs to remove outdated content from edge servers, they rely on Fastly’s instant purge capabilities to remove old content from the cache in 150 milliseconds.
“We couldn’t gain the confidence of our editorial team to place a CDN in front of our website unless we could clear content from the cache instantly. If breaking news happens and it isn’t on our site within seconds, visitors will go elsewhere. With Fastly, updates are reflected on our site pages within milliseconds and we’ve seen a 20% improvement in time to first byte around the world.” Matthew O’Brien, Software Architect
As the Guardian is a global news outlet competing for readers, the ability to update breaking news in real-time and handle resulting traffic spikes is critical. With Fastly in front of the site, the Guardian is confident that any increase in requests from breaking news – such as Margaret Thatcher’s death – will not strain origin servers.
When the new royal baby was born, the Guardian’s traffic spiked from an average of 400 requests per second to over 1,000 requests per second. Fastly shielded the Guardian’s origin servers from the hundreds of thousands of new requests pouring in, delivering consistent performance for readers around the world.
“We can’t predict when people might come to our site en masse for one or two pages because we can’t predict the news. Instead of wasting money on lots of servers that sit around waiting for potential spikes, we have Fastly as an edge cache provider to take the strain off our origin. For us, it means that no matter how many people visit our site, our servers will never be overwhelmed.”
The Guardian leverages Fastly for increased control over the company’s application, and Fastly improves the Guardian website’s performance by caching dynamic content, such as HTML and API calls. Before Fastly, the Guardian was using a CDN for static content only, resulting in a slow experience for readers located geographically far from origin.
“Self-provisioning makes things a lot simpler. It meant we could develop and release more quickly without having to rely on Fastly making the changes for us.”
On Fastly, customers can set up new services, test new features, or debug issues without relying on customer support. The ability to customize Fastly services themselves has allowed the Guardian to develop new products faster.
“We had such complex systems, the only way we could get a CDN in front of it was if we had something as powerful as Varnish to get around all the idiosyncrasies of our website. We used support quite a lot, and they were always really responsive.”
When moving domain from www.guardian.co.uk to www.theguardian.com, the Guardian leveraged Fastly’s self-provisioning service to configure two versions of the site, allowing them to deploy changes to the beta version, and then test it against the live version. When they did need the help of support, the Guardian found Fastly’s customer service engineers to be accessible and knowledgeable.
“All developers are control freaks. Fastly gives me full control of my entire stack. Normally, when you hand over parts of your application logic to a third party, you lose some control immediately. But with Fastly, we didn’t lose any control over the logic we had at the edge. It’s this transparency and control that gives me confidence in the service.”
Fastly’s flexible application allows customers like the Guardian to integrate a CDN seamlessly with their development environment, allowing for increased visibility and finer control. With the Fastly API, the Guardian can do automatic deploys and integrate with GitHub, which provides them with a traceable history of changes and continuous integration. Automatic deploys also eliminate the need for their team to manually upload files to push changes.
“With Fastly we can do automated deploys. We commit our VCL into our GitHub repository, then the project gets built and tested in TeamCity and an artifact drops out at the end. That artifact gets unzipped, the files get pushed out to Fastly. You couldn’t do that without having the Fastly API. And someone doesn’t have to manually upload twenty files to a browser to make a change. The Fastly API is important so that we have a traceable history of the changes that we’ve made and we can hook it into our continuous integration.”
Fastly also allows customers to stream logs in real time to any endpoint. The Guardian uses Fastly’s log streaming feature as an early warning system to detect issues after changes are deployed to their site. The Guardian streams logs to S3 buckets, then parses the logs for robot activity to see if any changes to the site affected the search engine or social bots.
As the Guardian is an international news hub, delivering excellent performance to visitors around the globe regardless of device is key. The Guardian uses Fastly to ensure that readers see the news most relevant to them. Adding geolocation headers to requests that are then processed by the company’s application, the Guardian serves one of three editions – US, UK, or Australia – to visitors based on their location.
“With Fastly, requests come in, we look for the user agent, and we switch the backend based on that user agent, meaning that we only have one url namespace - and we don’t have a separate mobile and desktop subdomain. It’s wonderful for many reasons. It means people don’t get redirected, time isn’t added to requests, and we don’t have to maintain parity between two url namespaces. When we eventually turn off the old legacy system and our new responsive site kicks in, we won’t need to do any configuration at all.”
Using custom VCL logic at the edge, the Guardian can also identify the user agent of a visitor when the request comes in, and then serve the content from either their mobile or desktop backend. Serving the requested content directly from the correct backend without redirects results in a much better visitor experience from a single domain. Read more about how the Guardian merged domains and unified their desktop and mobile sites on the company’s developer blog.