peshkova - Fotolia

Modernize legacy applications with containers, microservices

To break down monolithic apps and modernize them for cloud deployment, enterprise development teams continue to turn to containers and microservices.

Technology obsolescence and technical debt in enterprise IT have become so common that application modernization is a continuous activity.

To modernize legacy applications, most businesses today are keen to move those apps to the cloud and often rework them into various cloud services. Cloud-based app modernization facilitates a move from tightly coupled to loosely coupled architectures, which are usually less expensive to run, said Carl Lehmann, principal analyst at 451 Research.

Other perceived benefits of moving legacy apps to the cloud include deployment and release agility, access to emerging cloud services, flexibility, elasticity and long-term cost of operations, Lehmann said. Enterprises should be aware, however, that sizable transition costs, largely in enterprise architectural changes, often preclude long-term cost reductions.

Still, containers bring portability to applications, as well as lower operating costs. "Generally, you can run them where you need to run them, and you pay by the drink, as opposed to paying for an always-on server architecture," Lehmann said.

Microservices help developers assemble and change code quickly, and they're also a pay-per-use option. "If you develop microservices properly, they become Lego building blocks for applications," Lehmann said. "That's an efficient way of assembling applications, as well as modernizing them."

Microservices vs. monolithic architecture

Containers for app modernization

Container portability enables enterprise IT to abstract applications from the software and hardware environment in which they run. Traditionally, it's hard to modernize legacy applications designed or configured to run on a specific system without lots of reconfiguration and/or reprogramming.

"Once the application has been adapted to run inside a container, it will work in the same way -- without any configuration tweaks -- in any type of host environment that supports containers," said Chris Tozzi, analyst at Fixate IO.

Carl LehmannCarl Lehmann

Containers enable portability because they include all the variables and dependencies that could impact the way an application runs. Everything external to the container, such as the OS, doesn't affect the application. "As a result, when you move the container to a new host environment -- like a new cloud host -- you take everything with it that the application needs to run," Tozzi said.

Containers essentially eliminate the need to reconfigure an application when it moves from one environment to another. The developer can rely on the scripts that are baked into the container to work, no matter the environment in which the app is run.

Chris TozziChris Tozzi

Containers can only do so much, however. Put a monolithic app in a container and onto a cloud platform, and it's still a monolith. "It won't scale correctly, because you have to scale the entire application," said Brad Irby, an independent enterprise architect specializing in application modernization. "In a monolithic app, everything is so tightly coupled that you can't break it into smaller pieces."

Chipping away at the monolith

Just as containerizing a big legacy app -- lock, stock and barrel -- isn't a good way to modernize a legacy application, nor is adding new features to a monolithic app. "When implementing new functionality, don't add more code to the monolith," said Steve Bennett, senior technical project lead at Soliant Consulting. Instead, he said, turn the new code in to a stand-alone microservice.

Brad IrbyBrad Irby

Breaking legacy apps up into small, internal services is a good way to chip away at the monolith, Irby said. To start, separate classes that provide services to the rest of the monolith. Look for a service that makes sense to break up into a microservice, which largely means it is easily accessible via an API instead of an internal in-process call, he said. Then, modernize by refactoring the microservice.

Legacy applications often have business logic or a feature that the business is not ready to completely replace, and that's where the microservice comes into play, Irby said. "It allows you to do a minimal noninvasive surgery on a legacy application so that you can start moving functions into new, modernized components," he said.

Steve BennettSteve Bennett

Using microservices, developers and architects can phase out modules, interfaces or functions within the legacy application that run in a container and on the cloud and are delivered with continuous integration, Bennett said.

Getting started

Irby suggested that teams begin this microservices approach with an easy application modernization project, one which requires only a few changes to the legacy app. If all goes well, move on to a more difficult project that involves changes to many aspects of a complex, widely used application. After two projects are completed, the team knows that all the architecture is in place, that all the servers are stood up and that network operations and security setups work.

From there, the lead team can roll out app modernization projects to more teams. "They can look at the existing refactorings, figure out the pattern and at least start doing it themselves," Irby said. Of course, some coaching may be needed, but this method can empower the whole team to chip in to meet modernization goals.

When implemented properly, microservices and containers streamline the development process by removing interdependencies in the monolithic development approach, Bennett said. Implementing microservices and containers also makes applications elastic in order to withstand future enhancements and environment changes far beyond the standard application lifespan.

Next Steps

Factor performance into an application modernization strategy

Dig Deeper on Cloud app development and management

Data Center