San Francisco, CA
Customer since: October 2013
HotelTonight is a popular mobile application that provides easy on-the-go booking of same-day unsold hotel inventory. For their 10,000+ hotel partners, the company offers a marketplace to fill empty rooms, while travelers benefit from convenience and great value at quality hotels. HotelTonight now operates in 28 countries and boasts close to eleven million app downloads.
After experiencing rapid global user growth, HotelTonight needed to scale their infrastructure and improve performance without rewriting their entire platform. They wanted a CDN that could act as an extension of their stack, giving them more granular control and insight into traffic. As a mobile-first application that serves users with dynamic, location-based content, they needed a way to accurately identify a user’s location while speeding up responses coming from their origin.
“Fastly is delivering performance that we couldn’t have imagined through our Rails stack. It’s just exponentially faster. We sleep calmly at night knowing that spikes in traffic will be handled by Fastly.”Harlow Ward, Rails Engineering Lead
“Surrogate keys allow us to programmatically expire content that would have been very complex to expire before. We can set it and forget. The surrogate keys just worked out of the box, having used Russian Doll-style caching for our JSON payloads on the Rails side this felt very natural for the team. That was a huge win for us using Fastly.”Harlow Ward, Rails Engineering Lead
Fastly is powered by a heavily customized version of Varnish, a state-of-the-art web accelerator for dynamic content that enables intelligent caching and allows businesses to push application logic to the edge. By writing and then instantly deploying cache configurations using Varnish Control Language (VCL), HotelTonight can customize their CDN so it becomes an extension of their application.
Using Fastly’s surrogate keys purging feature, HotelTonight can create relationships between objects, such as the photos or profile language for a specific hotel, and purge those objects simultaneously.
Custom VCL also allows HotelTonight to manage the subtle variations in requests that are sent from phones based on the users’ app version and device. In some circumstances, phones send URLs with outdated or extra parameters, making the URLs less cacheable. Fastly’s ability to rewrite URLs at the edge allows HotelTonight to generate homogenous URLs, which means the non-standard URLs do not negatively impact their cache hit ratio.
HotelTonight’s success lies in the company’s ability to quickly provide users with information about the best hotels closest to them. To do this, they rely on cellular GPS data that varies wildly, since phones sometimes send latitude and longitude with up to 10 decimal places. If a user were to be 20 feet from another user, they would both have unique URLs, making it very difficult to cache the hotel room results, even though the results would be identical.
Fastly’s Varnish-based software makes it easy for HotelTonight to create geo-fenced URLs that effectively group requests from users within the same proximity. This gives them enough accuracy to continue serving users fantastic hotel rooms, while reducing the amount of unique requests to the hotel inventory API by a few orders of magnitude. The reduced amount of unique requests combined with Fastly’s ability to cache dynamic content (like an API) allows HotelTonight to successfully reduce the load on their origin while simultaneously increasing responsiveness for their users.
“There was a big unknown for us with the geo-fencing approach. We'd toyed with the idea of geo-fencing requests for some time. As with all new features on the platform we A/B tested it and the performance increase was astonishing. Historically the hotel list has been the most expensive to serve; now (once the cache is warm) we can return results in under 50ms. It’s awesome!”Harlow Ward, Rails Engineering Lead
Through Fastly’s developer-friendly control panel, customers can easily make changes to their configurations, such as modifying the default time-to-live or setting Gzip for assets, without needing to write their own VCL. When HotelTonight’s needs outgrew the standard options, they relied on Fastly’s knowledgeable support engineers to guide them.
"The Fastly control panel does so much for you, including wrapping complex VCL, and Fastly support is great. The first time we jumped in to write some raw VCL it was really, really helpful to have the Fastly support team there, step by step along the way, giving us ideas and helping with the syntax."
Harlow Ward, Rails Engineering Lead
“We’re absolutely seeing improvements on Fastly. From a mobile perspective, speed is king. We need the app to be totally responsive. The challenge for us is always going to be mobile network latency. With Fastly serving content from multiple POPs, the network latency has been cut down significantly. Fastly has changed our perspective on how we cache things and how we serve up our endpoints.”Harlow Ward, Rails Engineering Lead
Providing users with a responsive, snappy experience is critical for any application, but it’s even more important for mobile apps that are subject to cell network latency. By caching both static and dynamic content with Fastly, HotelTonight has dramatically increased their cache hit ratio, meaning they can serve more content to users from the edge. This results in better performance for the end user, despite fluctuating cell network performance.
“At HotelTonight, losing our speed of innovation to deal with scaling issues was not acceptable. Fastly had proven successful at a previous company, and we believed that it could provide a significant boost for HotelTonight. HTTP caching offers the most significant return on investment for a service like ours. Once we integrated with Fastly, we saw dramatic performance gains that allowed the team to focus on innovative features.”Sam MacDonnell, CTO HotelTonight
Higher hit ratios resulting from Fastly’s ability to cache anything enable HotelTonight to save on origin infrastructure expenditure. Now that they’re serving most responses from Fastly edge servers, HotelTonight needs fewer origin servers to handle requests.
“Once we get one of our endpoints on Fastly, we see a dramatic reduction in the traffic hitting our servers--sometimes over 80%--which has allowed us to cut out additional servers.”Harlow Ward, Rails Engineering Lead
Historically, New Year’s Eve was one of HotelTonight’s busiest days, with record-setting numbers of requests that HotelTonight’s infrastructure needed to absorb.
“During New Year’s Eve without Fastly, we had a lot of requests queuing on our servers, and someone always had to be on-call spinning up more boxes on Engine Yard. We don’t have to do that anymore. We’ve since seen several weekends with higher traffic than last New Year’s Eve, and we’re handling it with less servers thanks to Fastly.”Harlow Ward, Rails Engineering Lead
In addition, with Fastly reducing the strain on their infrastructure and speeding up application response times, HotelTonight now has the freedom and flexibility to incrementally improve their platform and explore new technologies.