Almost everyone who’s spent any time around application development and architecture over the past decade has come across the 12-Factor App. It’s a set of principles first published by the team at Heroku (one of the early cloud-based platform-as-a-service offerings), based on their personal experiences as well as what they witnessed from the many applications running on the platform. For a certain class of application built in a certain type of environment—the authors call out modern web apps—the 12 factors remain the gold standard in architecture.
However, not all applications are created equal. Or, more specifically, not all applications are greenfield creations designed with modern tooling, practices, and architectures in mind. Inside many large enterprises—the types of organizations that can’t afford to “move fast and break things”—are hundreds or thousands of legacy applications that aren’t so easily dismantled and refactored as modern 12-factor apps. Modernizing a couple of mission-critical monoliths around these criteria can be a challenge that takes several months—modernizing a whole portfolio could take forever (in IT years, at least).
“Do you understand your app well enough to restart it and trust it will come back up?” - James Watters, VMware
Rather than throwing up your arms in exasperation at the prospect of such a Herculean chore, you might instead decide to make sure all your important applications—even those that will remain monoliths for the foreseeable future—at least adhere to a single factor: the ability to restart quickly and reliably.
These 1-factor apps, as VMware’s James Watters calls them, can be a litmus test for whether a company is really committed to a large-scale modernization effort. It’s hard to talk seriously about automation and modernization if critical applications can’t even handle restarting—especially when Kubernetes is supposed to be part of the solution.
Most, if not all, applications can technically survive a restart. However, what distinguishes a 1-factor app from any old app is that its components, dependencies, and behaviors are well understood, and are optimized to function in a modern, cloud native environment. It’s not enough to simply package applications as containers, although that is a prerequisite. Rather, the application’s operating instructions must declare the appropriate launch sequence and how to act in the event of certain issues.
This is because Kubernetes is fundamentally a scheduler designed to intelligently start, stop, and relaunch application containers based on a declared ideal state. Having applications that can restart and relaunch without issue is the bare minimum for using Kubernetes effectively. One component starting out of order, or taking too long to start up, can create any number of issues around downtime or endless failure loops.
More generally, relatively frequent restarts are just an inherent aspect of modern software development. For example: Studies typically find that most container images last less than two weeks before they’re updated—and restarted—as part of a CI/CD pipeline, to patch a vulnerability in an application component, or for some other reason. And most Kubernetes clusters will require a rolling update at least annually because, like many open-source projects, the Kubernetes community moves fast—pushing version updates four times per year and limiting long-term version support to about nine months.
Being able to gracefully restart is not the holy grail of cloud native resiliency, portability, and declarative automation, but it’s a good start. Even if 12-factor or some other significant refactoring is the long-term goal, 1-factor is an achievable short-term goal that moves things in the right direction. It’s the connective tissue between Kubernetes and full-fledged app modernization.
If you want to hear more from Watters on 1-factor apps, listen to this excerpt from our Cloud Native in 15 Minutes podcast. To hear him discuss how we ended up in this cloud native, increasingly Kubernetes-centric world, listen to the whole episode here.
About the AuthorMore Content by Derrick Harris