The Gilt Groupe was looking to build out next generation services for their incredibly successful e-commerce site predictably and reliably. Gilt turned to the Lightbend Platform, which makes it easy to build software based on the Scala programming language, Akka middleware and Play Framework.

About Gilt

Gilt Groupe provides instant insider access to today’s top designer labels, at up to 60% off retail. Members can find something new every day for women, men, kids and home as well as exclusive local services and experiences, and one-of-a-kind travel packages.

The Switch to Scala

The original Gilt website had been built on Ruby on Rails, but portions had migrated to Java over time due to issues with scaling. Gilt liked the concept of a JVM language, and had looked at languages other than Java in the past. They had settled on Lightbend's Scala programming language as many engineers were very passionate about it and pushed to adopt it. It is more productive to code in Scala than Java and this allowed Gilt to write less code than any previous language that they had evaluated. Furthermore it is very easy to integrate Scala with legacy Java services. Scala is inspired by the long tradition of functional programming, which makes it easy to avoid shared state, so that computation can be readily distributed across cores on a multicore server, and across servers in a datacenter. This makes Scala an especially good match for modern multicore CPUs and distributed cloud-computing workloads that require concurrency and parallelism.

Something New

The main concept of Gilt is that of a flash sale. This is already exciting and already has people dropping what they are doing in order to shop on Gilt; there is a gaming element to it. Gilt’s Customer Segment Team, lead by Kristen McGregor wanted to introduce new ways of shopping that provided more unique experiences for users. Gilt Live was a way to add another kind of experience. Gilt Live is pushing the boundaries of the e-commerce retail experience with an innovative new way to shop on Gilt that allows Gilt members to discover and share products through a real-time view of all member purchases. Simply clicking on an image in Gilt Live allows a member to drill down into the product, see how much is left in inventory and purchase it immediately if wanted. Implementing Gilt Live required a fresh look at the available technologies, as some extremely specialized functionality known as WebSockets was required. According to Jonathan Goldberg, a Technical Lead at Gilt, they had already gone through a rogue’s gallery of web frameworks however they decided to see what Lightbend's web framework, Play could offer. Play is a framework based on a lightweight, stateless, web-friendly architecture that features predictable and minimal resource consumption (CPU, memory, threads) for highly-scalable applications. Gilt chose to use Play in part, because Lightbend was behind it and they knew they could trust a product with Lightbend's seal of approval. Gilt built a prototype of Live that worked very well, with very little code and was very fast to develop. Using Play and Scala allowed Gilt developers to be highly productive and enabled them to push boundaries of customer experience without worrying about the limitations of Java.

Working with Play

One of the key components of Gilt Live is the ability to send real-time messages to their members. Goldberg said they chose Play initially because of its scalability and support of WebSockets (a technology that allows bi-directional, full-duplex communications channels over a single TCP connection). It’s this functionality that enables Gilt Live’s real-time inventory updates. Goldberg says Play fit really well within their existing ecosystem; he also points out that with Lightbend, they are not beholden to any sort of clunky, monolithic frameworks. Play has since become Gilt’s preferred view framework.

The Benefits of Akka

Gilt Live is not only written in Scala, and leverages the Play framework, but it also uses Lightbend's Akka, a toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications on the JVM too. The Gilt site as a whole has a very unique traffic pattern. The peak traffic time for Gilt is at noon, every day when all of their sales go live. A huge percentage of Gilt’s business is done between 12:00 PM and 12:10 PM, so it is critical that the website can handle the extreme amount of traffic during that period. Akka is key to handling that traffic. Gilt’s website actually caches very little data, which means that every user request requires multiple concurrent requests to backend systems to fulfill. Akka’s Actors enable this very simply since they execute asynchronously to build page components until it is finally ready to be delivered. Akka Futures are a key technology to accomplishing this task. Gilt actually deployed Akka first in a “dark” release in its default configuration and found it to be tremendously performant. The system as a whole required tuning only in the load balancers to meet the scale requirements. Gilt has many different teams that have been involved in the development effort so far, and all have different KPIs, or metrics that they are measured upon. Architecture teams are all about up-time, adoption rate of new technology. The Customer initiative teams focus on different challenges ranging from internationalization, personalization, SEO, social, excitement, etc, while others focus on consolidation coefficient - how many technologies are being used across the entire Gilt portfolio, how they can be leveraged across the company, other teams focus on big data problems to help them make better decisions about their data matrices. Regardless of the KPIs, utilizing the various components of the Lightbend Platform has helped Gilt to ship more and reduce time to market.

Read the article.
Read the community story - Scaling Gilt: From Monolith Ruby App to Distributed Scala Microservices.

Inspired by this story? Contact us to learn more about what Lightbend can do for your organization.