Imgur is the most popular platform for browsing and sharing user-curated images online. With mobile and desktop apps for generating memes and more than 1.5 million images uploaded daily, Imgur has grown into one of the most heavily trafficked websites in the world, boasting more than 130 million global users and 5 billion monthly pageviews.
Because of Imgur’s popularity, they need to quickly serve billions of images without straining their origin servers. They came to Fastly while searching for a content delivery network (CDN) that could integrate with their stack and act as an extension of their application. The Imgur team also uses Varnish, the state-of-the-art web accelerator designed for dynamic content (such as websites, APIs, and mobile applications) on which Fastly was built. They were excited about deploying custom Varnish configurations to the edge of a CDN network.
Imgur sought a content delivery network that could provide the same flexibility and transparency that they have with their own stack. Fastly is currently the only CDN that uses Varnish, which gives customers complete control over their service, including the ability to make and deploy configuration changes instantly without having to go through customer support or professional services.
“We chose Fastly because of its flexibility. Fastly opens up the entire configuration to us; we can do whatever we want and then push it out. You can’t do that with any other CDN. Most CDNs have a complex UI that you have to mess with, and you have to access an engineer to make config changes. Fastly saves us time and energy.”
Alan Schaaf, Founder and CEO of Imgur
“We do what I would imagine most startups do: ship code out early and as fast as possible. When we change Fastly configs, we look at the error logs — if we break something, we can just roll it back with Fastly versioning. Fastly fits into our process because when we ship out a new config, it takes effect almost immediately. Moving quickly is a huge deal for us, and we’re able to do that with Fastly. The UI format gives us confidence because we can see literally everything that is happening.”
The ability to self-serve on Fastly is crucial for companies like Imgur that ship new code daily and value speed of innovation. Using either Fastly’s app or API, Imgur can customize their caching logic to match their needs in real time. This allows them to easily integrate Fastly into their team’s development cycle and gives them the control they need to feel confident.
Imgur believes in caching everything. With Fastly, they’re able to cache dynamic content, like API calls, as well as static content, like the hundreds of millions of images on their site. Imgur caches every API call for users who aren’t logged in for 60 seconds, allowing them to quickly serve content that’s the same for all users directly from the edge. When visitors log in, the API calls are cached for 1 second. With the help of Fastly, Imgur’s API easily serves 8,000 requests per second.
“Being able to cache APIs with a CDN is a big benefit. If a user is logged out, they send a specific header; if a user is logged in, they send another header. With Fastly, we’re able to detect the difference in the header and cache it depending on whether or not a user is logged in, so we don’t have to go to the backend to serve the same content over and over again.”
“Mobile performance is super important. We serve up the entire mobile experience from Fastly: our static files are served from Fastly, and our mobile site hits the API, which is also served from Fastly — so you can browse via mobile device without ever hitting our origin servers at all.”
“We use Fastly to serve all of our images — nearly 2 billion images every day, including 1.5 million new images. So there’s a lot of image serving. As a result, requests to the origin have gone down dramatically, which saves us money.”
With the ability to cache both static and dynamic elements of their site, Imgur has improved performance for end users. More content is served directly from the edge, geographically closest to end users, and the number of requests to origin has decreased, lessening the strain on Imgur’s infrastructure.
Before moving to Fastly, the Imgur team was running their own Varnish servers. Because Fastly is built on Varnish software, Imgur was able to move their custom Varnish configurations from their own Varnish servers to Fastly’s globally distributed edge servers, giving the team greater reach and increased control over logic at the edge. Custom VCL enables Imgur to generate the thumbnails associated with user-uploaded images on the fly and cache them with a singular URL, reducing load on origin while speeding up delivery.
“The way we serve content is pretty unique. It relies on the power of Varnish, and since Fastly was built from Varnish, our integration works really well.”
With Fastly, Imgur gains unprecedented visibility into their site’s performance. Fastly’s real-time analytics and historical stats dashboards allow Imgur to watch their cache-hit ratio, requests per second, and error rate, monitoring their site performance in real time.
“It’s amazing to have access to real-time analytics after switching to Fastly — we are now able to watch Imgur do more than 40,000 requests per second.”