Migrating_Your-Legacy_apps

Migrating legacy applications to cloud-native environments

Posted by Simon Red

You need to migrate legacy applications to cloud-native environments. Where do you get started?

The cloud has introduced a whole host of new services and capabilities that businesses are scrambling to capture. Rewriting your entire software base is rarely an option. But, legacy code was not written with the cloud in mind.

The answer hit on time and again, is to use containers — allowing you to isolate core functions and build additional features where needed.

Great, we all love Docker and Kubernetes!

But, nothing is that simple. Containerizing those applications safely requires confronting an observability issue at the heart of cloud-native (and even DevOps) that the entire industry is reluctant to face. You also need to understand the difference between simply being ‘in the cloud’, and being ‘cloud-native’.

This is your guide to cloud-native, legacy app migration, the new observability platforms that are poised to disrupt the CI/CD toolchain and how DevOps should sit at the center of your IT strategy, now and in the future.

Step 1: Learn The Difference Between Being in The Cloud and Going Cloud-Native

Rehosting your legacy applications in the cloud is relatively simple. There are security, access, portability, and vendor choice concerns. But, the challenge is fundamentally about securing the right IT provisions — either a private cloud server, access to a public cloud provider and the necessary bandwidth/storage to host and access your applications and data.

Simple cloud migration can deliver long-term maintenance and management cost savings and provide improved access (on and off-site) to data and applications. But, nothing fundamental will change about how your applications operate, or how they can be further developed. The changes are all limited to how your teams access that data and where that data is stored.

In reality, cloud-native is something of a buzzword. Central to it, however, are real technologies, methodologies, and architectures like containers, serverless and microservices. Fundamentally, these are all very similar sides of the same thing — the practical ability to scale rapidly, support a dynamic and large number of users, and accommodate distributed development and operations teams under the unified DevOps banner.

Your ability to access these scaling and development capabilities are what define cloud-native, and are what set modern applications apart from your legacy ones. If you want to be cloud-native, you need containers. Fundamentally, you need to change your code, how it integrates and communicates with itself, outside applications, and future changes made to your software stack.

This is all far more complicated than simply rehosting in the cloud.

Step 2: Understand Containers, Then Use Them to Modernise Your Applications

Cloud-native and containerization often get used interchangeably. This can be confusing but is entirely justified. The “container” is what enables programs to take full advantage of the cloud. At its heart, cloud-native is containerization.

A crash course in containers

Containers allow for abstraction at the application layer. They are like VMs, but on a smaller scale, with a smaller footprint. Each container houses the minimum requirements to run an application or simple segments of code. You are able to run that code and its dependencies independently. There is no impact on other containers, data produced by the application or the operating system.

Containers transform what were once monolithic and interwoven application development strategies into broken down and distinct services, each packaged within a container — effectively deployed as a microservice delivering the same output as the old monolith. This makes a change, scaling and construction all far simpler.

A container-based approach has become standard for modern application development. It is flexible, resilient, capable of change, quick to shift and fast to deploy. Developers can focus on the code, using different languages where they are the best fit, and building/modifying each component on an individuated basis. Containers can be versioned, shared, archived, and they can be built on top of one another.

Fundamentally, containers standardize the method of transportation and interaction between bits of code, applications, and data. Like the containerization in shipping that revolutionized global trade during the 20th century, containerization of software makes the payload irrelevant to how containers interact with each other and the wider world.

If you don’t know where to start, start with Docker

There is a maze of programs that support, build, manage and maintain containers. But, Docker is the standalone leader in this space with a strong compatible ecosystem.

The power of Docker is open source. That means Docker is cheap, it’s free if you really know what you are doing, and it is cutting edge. The number of integrations, purpose-built capabilities, and support features is nearly limitless. Of specific note is Kubernetes, another open source clustering platform started by Google in 2015 to manage containerized workloads and facilitate automation.

Both open source operations, Kubernetes and Docker have flowered into a thriving ecosystem of tools, functionality, and plugins. It is there to be explored and delivers powerful solutions for new software development. But, equally, they provide legacy applications an avenue to modernizing the very core of their code and capabilities.

Docker isn’t your only choice, and Kubernetes works with other solutions as well, such as CoreOS rkt. But, they are the standard to beat and are the current pack leaders for a reason.

Step 3: Identify the Best Route For Your Legacy Application

Although containers will be central to your approach to the cloud, not all legacy applications can be approached in the same way. Not all legacy applications are even great candidates for cloud migration, much less cloud-native refactoring.

For starters, really old applications written in old languages cause problems. If your application is currently mainframe-based and written in something like Cobol or Fortran, or built using a proprietary language, migration might be more trouble than it is worth. The tooling landscape is always changing. But, right now, it is likely cheaper to start over.

Second, applications that tightly couple their functionality with their data store will require huge rewrites. To do anything other than rehosting such an application would require decoupling the data from the application. In doing so, you will basically rewrite your software anyway.

Third, badly designed applications should be a non-starter. This is a chance to start to overtake it if you think you need it.

What do you do with unfit, legacy applications?

When looking to migrate a tightly wound mainframe application or one written in an old language, the economical choice kind of sticks you with ‘rehosting’ or, what one might call, the ‘monolithic container’ approach. Here, you simply wrap the whole existing application in a container, ship it into the cloud and move on. This is simple. But, it doesn’t change the functionality of your legacy application. This is not cloud-native, but it will get you into the cloud.

Depending on the actual state and functionality of the applications, this may allow you to add on new functions using a containerized (cloud-native) approach or even alter outputs of existing functions with new containers. But, you will always have this core, monolithic container that sits uneasily within your wider cloud-native ecosystem.

Containerising legacy applications that are fit for cloud-native refactoring

Legacy applications that are suited to cloud-native environments are those that can (relatively simply) be sliced into component pieces. Java and .NET Core applications often make good candidates, although the specifics always matter. What is important is that components can be isolated and put in containers without significant disruptions triggering time-consuming rewrites.

  • What to do: identify the application’s functional primitives and break them apart. Use container services to package each primitive and then build the components back together, reforming the whole.

The next challenge is data. Truly cloud-native applications separate data from the application, enabling each to be changed without damaging the other, and allowing data to be shared across applications and containers.

  • What to do: build a framework that delivers data access ‘as-a-service’ for use by the application. By allowing all data calls to go through this data service, you will decouple the application from its data. This enables you to change the data without breaking the application and supply other containers access to that data.

Achieving either of these outcomes will give you greatly improved functionality and future proofing capabilities. Doing both will deliver a truly modernized application outcome. Then you just need to get ready for production failure that may arise.

Step 4: Upgrade Your Observability Capabilities

When migrating applications to a new architecture, make sure that you have the ability to quickly spot and resolve errors. If you change everything around an application, things are bound to go wrong. There’s really no two ways about it.

This reality, however, requires confronting the dirty secret of containerization — problems in diagnosing software bugs. Containers come with huge benefits, but there are costs. Be prepared!

The cloud-native observability crisis

Splitting your applications apart into component pieces makes it far easier to edit, grow and build those applications, along with using the data generated for any number of purposes. However, it makes it far harder to see what is going on, where faults lie and how each individual piece of your application is truly functioning.

If your network fails, the distributed nature of containers makes identifying the real root of that failure nearly impossible with traditional troubleshooting and debugging tools. Error logs are disaggregated, each in different formats. The freedom that the container delivers to development creates a nightmare for operations and error resolutions. Solutions can be found (maybe) with an ability to trace a failure back to a containerized location. But, the entire process slows to a crawl.

The same issue persists if relying on traditional APM (application performance monitoring) tools. These will, again, point you in the direction of the fault, but they cannot tell you the ‘why’ of your failure.

Traditional error logs could tell you why, but practicalities prevent this. You simply can’t log everything and sift through those logs would be near to impossible. Even if you did manage to log the right information and identify that information as important, you are still stuck with a disjointed mess that needs to be pieced back together against what actually happened in the application.

Looking at logs is like looking at pieces of a crime scene to build a reproducer of the problem. Your solution is ultimately the best guess. You have to redeploy it and just wait to see if it works. If it doesn’t, you are stuck in a loop. This is slow and iterative, causing uptime failures every step of the way.

What is worse is that this is just the best case scenario. Most of the time, you can’t even capture the relevant logs, leaving you entirely in the dark. The reality of logs is that if you know what to log, you have probably already identified the problem. Logs barely cut it in traditional application environments. Where containers are concerned, they are a broken solution.

Advances in debugging: a background worth understanding

Root logs have been the staple of debugging and error resolution since basically the beginning. But, an upgrade has been in the works for quite a while. Record & replay debugging, often called ‘flight recorder software’ has delivered increasingly accelerated methods of resolving faults within test environments.

Here, the actual step-by-step operation of an application is recorded in entirety, providing both log data and the exact execution phases joined together. This can be viewed by the developer within an IDE (Integrated Development Environment), and stepped through (backward and forwards) to see every detail — delivering observability that is otherwise unattainable.

Traditional record & replay debuggers provide unparalleled flexibility to developers looking to test new code, understand the mechanics of execution and improve outcomes. However, they are not practical in production environments. The impact on performance is astronomical, slowing down applications by 10x or even 100x, creating problems almost as large as those they are trying to fix.

The issue is that test environments can never truly replicate a production environment. Even without DevOps and CI/CD, tradition record & replay debuggers fall down as a real answer to the issue with logs.

The better way: true cloud-native observability platforms

The upgrade is the development of true observability platforms that place these record & replay debugging capabilities within a wider toolset that can be deployed in production.

These solutions take a new approach to execution. Rather than using run-time agents that inject code into the application at load-time, an approach is taken that instruments the application at compile time. Using flexible settings that allow users to select how many steps back are recorded, these observability platforms can be deployed in any environment with less than 10% impact on performance.

Placing these capabilities within production environments has allowed for more features to be built around that basic record & replay premise. These are purpose-built to accommodate the fast release schedules of continuous deployment DevOps strategies — the fastest way to root cause analysis and pushing out a fix.

Monitoring tools allow DevOps teams to access heat maps of global production deployments in real-time. Algorithms monitor for failures and automated rollbacks to the last known ‘good release’ can be executed in milliseconds. Within seconds, recordings are available for developers to analyze within their preferred IDE. Reverse debugging can then be deployed to identify the root cause, create a fix and push that back into production.

True observability solutions are not simply debuggers. They deliver constant monitoring, performance profiling, and session recording. Fundamentally, this is the automated error resolution platform that is missing from the current CI/CD tool-chain.

If looking to take on the challenge of migrating your legacy apps into a new, cloud-native architecture, you need to give yourself the best chance possible at resolving the unforeseen errors that arise. That means investing in these advanced observability tools that work in cloud-native, microservice (and even serverless) environments. That means true cloud-native observability platforms.

Step 5: Deliver DevOps in Cloud-Native: Legacy Software or Not

DevOps should be central to your new cloud-native strategy, both during the migration and after. In fact, going full DevOps should be a contributing motivator to going cloud-native. Anything less and you are selling yourself short.

DevWhat? A primer on something we hope you already understand!

In case you have been living under a rock, let’s do a quick refresher on DevOps. DevOps is the merger of development and operations into a single function and methodology. It is a strategy that seeks to maximize speed, innovation, functionality, and uptime. It removes the wall between Dev teams and Ops teams to create a “you build it, you run it” mentality and culture.

Central to DevOps is the goal of avoiding large, monolithic and waterfall-driven development projects in which entire applications are built, arduously tested and then rolled out in the hopes that they will function flawlessly. Rather, an incremental and continuous deployment and integration approaches are favored to both development and operations.

One huge contributing factor to the power of DevOps is its acceptance faults. The reality that idiosyncrasies of different production environments will inevitably cause problems that could not be foreseen in the test is embraced and used as an advantage. Rather than expecting perfection, the production environment is used as a final and continuous test-bed in which issues are resolved.

This is enabled by a continuous and incremental approach to development. Programmes are built in many stages, and patches, extras, and auxiliary functions are bolted on and then continuously tested in-production. Although this can sound sloppy, when executed properly it is far faster, causes fewer serious issues and allows for more innovative solutions.

DevOps and containers: a match made in heaven … and hell

The modular ‘DevOps approach’ to programming and development is why containers and microservices are such a great match for DevOps. But, it is also why the observability flaws in legacy APM tools, when applied within a containerized environment, pose such serious issues.

Fundamentally, full observability and rapid root cause analysis is central to DevOps more generally, just as it is to containers. If root-cause solutions cannot be rapidly identified in production without damaging performance, uptime failures can occur, and potential cyber risks left unaddressed. This places customer happiness, business reputation and ultimately revenue at risk.

The good news is that there is now a solution. You just need to make sure that you investigate and invest in observability tools that will deliver the kind of perspective on your containerized applications that will allow you to rapidly resolve errors in real-time. This is not simply an investment to get you into the cloud and containerize your applications, it is a key attribute that will allow you to take full advantage of DevOps methodologies within a cloud-native environment.

But, observability investment from the beginning will make the job of migration simpler. You will be prepared for outages, meaning that you can work as you go. Rather than having to strip your applications out of production, work on refactoring and then undertake lengthy tests, the entire process is streamlined, with faults fixed as they occur and far less time lost in migration. The same observability platforms can be used to aid in any re-coding that occurs, and make the process of further development that much simpler.

Cloud-Native Requires DevOps and Containers: Observability Platforms Give You Access to All Three

Cloud-native is more than the cloud — it is about creating applications that are truly designed to take advantage of everything the cloud has to offer. That means scalability, flexibility and distributed speed. If this approach to application architecture is not coupled with a DevOps strategy, you are missing a piece of the puzzle.

Not every legacy application really can make this transition. Your first job is to make sure that you aren’t wasting money. The amount of change that some applications require to really take advantage of cloud capabilities can be so large that you might as well start from scratch.

For other applications, a little refactoring and containerization can drastically transform the performance, capabilities and growth potential of your legacy software stack. Once cloud-native, further development becomes far simpler, and the flexibility in operations is hard to quantify. A DevOps approach is made simple, and you will truly modernize your programming and operating capabilities. This same DevOps approach will also make the migration simpler, faster and smoother.

DevOps and cloud-native, however, will only succeed if you can gain real-time visibility over your entire range of production deployments. Unfortunately, for all the benefits delivered by containers and microservices, they will make observing and monitoring your applications much harder. When it comes to the delicate task of migrating legacy applications to the new architecture, this spells disaster.

The solution is Observability Platforms that deliver in-production. Coupling this technology with a DevOps methodology will not only make the migration into a cloud-native environment far simpler, but it will also allow you to continue to progress and grow at speed once the migration is complete.

Cloud-native faces an observability crisis. But, compile-time, observability platforms are the answer. Taken together, cloud-native, DevOps and observability platforms deliver to modernize your applications and development/operations capabilities. The future is here — make sure you grab it!

Download for free

Submit a Comment