Case Study: From Monolith to Microservices With Micronaut

Case Study

Micronaut Dramatically Reduces Application Startup Time and Minimizes Memory Footprint

A large, consumer-facing IoT device network that relied upon a monolithic architecture found that the network struggled to keep pace with increasing demand. In response, the team built a lightweight microservices system using the Micronaut framework, which provided the smooth learning curve, extensibility, speed, testing ease, and scalability necessary to better serve its growing customer base.

The Client

SmartThings, a subsidiary of Samsung Electronics, provides consumers at-home IoT experiences through a range of sensors, smart devices, and digital apps. SmartThings customers have the ability to control, automate, and monitor household fixtures, such as lights, locks and security systems, electrical outlets, and more, via their mobile devices.

The Challenge

The key benchmarks for measuring success using SmartThings’ “smart” products are speed and accuracy. Homeowners who invest in smart technology expect immediate and consistent responses to both scheduled and spontaneous commands.

SmartThings' existing monolith application controlled approximately 550 services from a central server. The compute power necessary to manage this load was not only unwieldy, it resulted in unacceptable startup times during peak usage.

Additionally, extensive manual testing was required for each software change, and a single update test could take between 45 to 90 minutes for each service. This made continuous deployment difficult and resulted in taxing development cycles.

Finally, the company's growth exhausted compute resources and ability to scale; the more commands executed by SmartThings users, the greater the stress on the application. To further complicate matters, unpredictable surges in user behavior caused periods of reduced performance.

Objectives

SmartThings set out with three key objectives.

First, the SmartThings Hub and its mobile app required a new infrastructure that would allow for performance of critical operations at sub-second speeds. To deliver the speed and scale expected by its customer base, SmartThings set a 400-millisecond max on response time. This time limit represents the threshold of human perception, meaning any span of time longer than 400 milliseconds is likely to be noticeable as a "delay" to the user.

Next, any new feature implemented needed to be extensible into the distant future, and the company's engineers sought to reduce as much boilerplate as possible to accelerate development cycles. Thus, only solutions that empowered the SmartThings engineering team to rapidly develop, test, and release new software features were considered. 

Finally, the new system had to be scalable to both accommodate the growing number of potential users and to address load during peak use times.

“We initially selected Ratpack to transition our monolith application to a microservices architecture, but we found that the learning curve was too steep, and we were not as productive with Ratpack as we were with Micronaut.”

— SmartThings Engineer

The Solution

SmartThings recognized that it needed to transition away from its legacy monolith architecture to a more flexible microservice-based system.

A microservice architecture allows for nimble development and delivery of a wide range of interoperable services that may be modified and deployed independently. Such a solution clearly offered significant benefits to both the internal development team and the company's client base.

Once SmartThings leaders decided to transition their massive and complex existing system to a lightweight, interconnected infrastructure, they faced the challenge of building and migrating to their new platform as efficiently as possible.

They sought a framework that fulfilled all of the following requirements:

  • It had to be intuitive and easy for their development team to learn and use.
  • It had to be robust enough to handle a vast (and growing) number of services without slowing down or exceeding compute resources.
  • It had to meet the speed, ease-of-testing, and scalability requirements outlined above.
Micronaut: A new JVM-based, full-stack framework for building fast, lightweight microservices and serverless apps

After attempting to build a solution using Ratpack, SmartThings’ technical leadership turned to Micronaut, an open source JVM framework specifically designed for building scalable, highly performant microservices and serverless applications.

Micronaut fulfilled all of SmartThings' requirements:

  • A smooth learning curve ✔
  • Robust, extensible framework that enables speed and scalability ✔
  • Easy-to-test code ✔

Outcomes

By leveraging Micronaut’s cloud-native features and unique sensible defaults, SmartThings has achieved the following business benefits:

  • Consolidated servers

  • Increased workload efficiency in the cloud

  • Shorter development cycles

  • Reduced and better-controlled costs

More About Micronaut

Micronaut™ is a modern, JVM-based, full-stack framework for building modular, easily testable microservice and serverless applications in Java, Groovy, and Kotlin.

Micronaut includes all the tools a modern developer needs to effectively build microservices for the JVM, without compromising memory footprint and startup time.

  • Integrated compile-time dependency injection and AOP

  • Service discovery and client-side load balancing

  • Integrated HTTP client and server-based Netty

  • Sensible defaults and auto configuration

  • A suite of cloud-native features to boost developer productivity when building microservice systems

Micronaut may be used in scenarios that would not be feasible with traditional MVC frameworks, including Android applications, serverless functions, IoT deployments, and CLI applications.

We're Here to Help

Whether you're transitioning to a microservice architecture, upgrading existing microservices, or looking for a better way to build serverless apps, contact us to learn more about Micronaut and start taking advantage of all it has to offer today.

  • Micronaut co-founders, along with subject matter experts from around the globe, lead the OCI Micronaut team
  • Engaging the core Micronaut development team enables quicker project upgrades, improving speed-to-market
  • Our training programs are delivered by the core Micronaut development team, who are uniquely positioned to share first-hand experience with the Framework and to provide customized, targeted training
  • Engaging our team affords access to our network of Open Source technologists, enabling quick and seamless support for other projects
secret