Heluna offers a unique SaaS based anti-spam solution that processes millions of email messages daily. Heluna turned to the Lightbend Platform - made up of Scala, Akka and Play Framework – in order to future-proof the platform, and allow it to easily scale out to process well into the hundreds of millions of e-mails.
Heluna is a cloud-based anti-spam service that works with your current e-mail infrastructure.
E-mail is the single most important tool for today's companies. Heluna’s customers trust them to not only filter the 78% of all e-mail messages which are spam, but to also deliver their clean messages in a timely fashion.
Heluna has been in business blocking spam messages since 2004, and the Heluna system learns from every message that it sees. Your domain gets the benefit of years of experience and automated learning.
A common problem that leads customers to the Lightbend Platform is that of unplanned success; building a product on a technology platform that meets a need, but ultimately lacks an essential “ility” – reliability, scalability or availability. In Heluna’s case, the defining factor was scalability; about 6 months ago, Mark Beeson, Heluna’s Founder and Chief Architect began to see that the current architecture utilized by his email processing system had become untenable as it didn't gracefully scale horizontally to meet the rapidly increasing needs seen by the business.
Mark explains that the old platform was “extremely legacy based” – it utilized an off the shelf Message Transfer Agent (MTA), Sendmail for general purpose email routing and Perl and C as programming languages - the entire platform was comprised of incohesive third party products.
While this platform had worked for the last two years, it was clear to Mark that long term, it wouldn't work well. Mark’s vision was to scale the system transparently, improve performance, and increase visibility into its operational status.
Mark took an aggressive approach as he chose to use the entire Lightbend Platform; Scala, Akka and Play Framework. Scala is a general purpose programming language inspired by the long tradition of functional programming, which makes it easy to avoid shared state. Scala ensures the ready distribution of computation 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. Akka is a toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications on the JVM. Akka vastly simplifies the concurrency problem by providing developers with a higher level of abstraction in its Actor-based model. By utilizing Actors, developers can focus on writing business logic, instead of worrying about low-level tasks like state management, memory locking and thread management. Finally, Play Framework is based on a lightweight, stateless, web-friendly architecture that features predictable and minimal resource consumption (CPU, memory, threads) for highly scalable applications.
As a result of implementing the Lightbend Platform, Heluna’s new architecture consists of three main components:
- Mail Accepter
Processes incoming e-mail messages. This service consisted of a Scala application wrapped around a Java library. It proved to be very fast to implement.
- Mail Filtering
A redis queue is used to store the incoming e-mail messages. In an initial filtering activity, messages are forwarded to different Akka actors for high level filtering:
- Is e-mail message from a known spam host?
- Is e-mail signed correctly?
- Mail Delivery
Akka actors pull from the redis queue and send the e-mail messages to client systems.
The net result is a flexible architecture that can shrink and grow almost organically, making it easy to spin up more nodes on Amazon’s EC2 infrastructure.
With the backend processing in place, the next component Mark wanted to address was the Heluna website. The website not only advertises the Heluna offering, but it is also integral to the customer experience, with the ability to create personal user accounts that allows users to gain tighter control over their spam blocking; they can manage their own filter sensitivity, approved and blocked senders lists, and more. Users can also set up domain-wide preferences for mailboxes, and approve or block senders for everyone.
Like the backend, Mark used pure Scala, Play Framework and CouchDB for the website. The website allows users complete visibility into the backend redis queues so they may see a real-time picture of their spam processing.
Mark’s strategy had a substantial pay-off as he now has a massively flexible and scalable SaaS offering. When 90-95% of all messages processed by Heluna’s solution are spam, virus attacks, etc, Heluna still delivers well over 300,000 clean messages a day to customers.
Mark comments that when he made the initial move from Java to Scala, one of the greatest features was ramp up time; it is as long or short as you want depending on how functional you want to get, whether you want to write DSL’s, etc. It took him a few weeks to get up to speed with basic Scala, and another two weeks to get into the functional side of things.
All in all, the entire endeavor took Mark about two months start to finish, and he has a very small, concise code base.
Mark notes that he uses Futures extensively (a Future is a data structure used to retrieve the result of some concurrent operation), and CPU usage and blocking time is very, very low as a result. Previously, the old system would peg the CPU’s frequently, however now the load average is near zero.
The entire Lightbend Platform from top to bottom has been absolutely fantastic! Play is amazing, Akka has been unbelievable; it’s crazy to see how much coding time has been saved with Akka alone, and I cannot imagine using anything else.Mark BeesonFounder, Heluna
Inspired by this story? Contact us to learn more about what Lightbend can do for your organization.
Share This Case Study
Lightbend is the proud provider of the world's leading Reactive application development platform. We are a passionate crew of technology pioneers committed to building amazing software. We build and maintain the Play web framework, the Akka message driven runtime, and the Scala programming language. Our mission is to help developers build high-performance applications that are responsive resilient, elastic and message driven.