BrightTALK Increases Concurrency and Resiliency of Back;End Services with Akka and the Actor Model
BrightTALK is a leading provider of webinars and videos for professionals and their communities. Every day on BrightTALK, thought leaders from around the world are sharing their insights, their ideas and their most up-to-date knowledge with professionals in their industry. For marketers, BrightTALK provides a simple way to engage target customers and convert audiences into business leads. More than 142 million minutes of professional ideas and insights have been shared on BrightTALK to date.
The Business Challenge
In 2013, Alistair Cairns (VP of Engineering) and Brett Bell (Software Developer), along with a small team, were tasked to rebuild the “Live” platform—the code base that’s responsible for the critical back-end functions that power BrightTALK’s live webinars.
The original version of the Live platform was written nine years ago in PHP, and BrightTALK’s growth was stretching the limits of the language’s capabilities. More advanced animations and videos, larger file sizes, more features and more users—Live needed a complete re-write where concurrency, scalability and high availability were the key attributes. And they started to explore languages and platforms where “Reactive Programming” patterns (designing for responsiveness, resiliency, elasticity, and message-driven services) were first class citizens.
There are numerous components that must work in harmony for a live webinar to run successfully. Thousands of simultaneous viewers require mastery of scale and peak usage issues. Content delivery networks and caching services require coordination with external services and APIs that present challenges with concurrency.
“Companies go to great lengths to get customers and prospects to show up to webinars, and it’s important for their reputation that things perform smoothly and look great,” said Cairns. “It was critical for us to increase the flexibility of the back-end to handle our features evolution, the coordination between the expanding pool of services in production, and the ever growing number of users and amount of usage from the popularity of the platform.”
As Cairns and Bell deconstructed the first generation of the Live platform and set out to select a platform that could go beyond the limitations of PHP, the team did a lot of research on “full solutions” and patterns for programming for asynchronous processing, concurrency and other key patterns. A key turning point occurred when they discovered the Actor model, designed by Hewitt in the 1970s, and how languages like Erlang that embraced the Actor model were used in domains like telecoms that need 100 percent reliability and handle failures seamlessly.
The discovery of the Actor model led BrightTALK to Akka and Scala, and Cairns and Bell immediately “fell in love with the Scala language” and the “simplicity of Akka and the transparency of its roadmap.”
Today BrightTALK’s Live platform is a collection of microservices wrapped in Actors, communicating through messaging to run live videos on the web. A “Communication Supervisor” Actor instantiates actors in live events. An “Audience” Actor manages the audience perspective for live events and controls the “Viewing” service. A “Screen Share” Actor manages the state of screen sharing. More than 20 different Actors have wrapped very specific services with abstractions, handling everything from screen sharing, to what attendees see, to how presenters interact with audiences within webinar sessions.
“Akka has allowed us to greatly improve the reliability of all of these real-time events on the back-end of the Live platform,” said Bell. “As multiple data feeds get merged together, and as presenters and attendees go through their journey interacting with BrightTALK, we are able to make sure the integrity of the data is 100 percent, and that there are no longer single points of failure due to serial processing. Everything is highly concurrent and highly available, and that message passing is loosely coupled.”
Scala and Akka have allowed the team to make heavy use of futures for non-blocking API calls and fire and forget messaging within their actor-based services. It’s a much simpler and more sophisticated way to develop and manage a mission critical live webinar platform.
Business Benefits for BrightTALK
- Rapid development - The BrightTALK team was able to complete a rewrite of the Live platform in less than six months
- Not one critical failure - In the nine months the new Live platform has been running in production everything has run smoothly. The actor model makes concurrency much simpler to deal with leading to faster development time and more reliable production code
- Easier to maintain and extend - The team has found they can add new features much more quickly and the new platform is a real pleasure to develop with
Inspired by this story? Contact us to learn more about what Lightbend can do for your organization.