“Microservices is a software design and development approach that applies the Law of Demeter in the most practical sense: loosely coupled services working in harmony across hybrid environments,” says Bhanu Singh, VP of engineering at OpsRamp.
This approach suits today’s increasingly distributed hybrid cloud and multi-cloud IT infrastructures, but it comes with some complex challenges when answering a seemingly simple question: How do all of these loosely coupled services work together?
APIs are a huge part of solving that complexity. Singh notes that each microservices component exposes standard APIs so that it can be consumed by other services; in turn, each component consumes the other services it needs via APIs. APIs, Singh explains, are what maintain compatibility and interoperability in a microservices architecture.
“APIs are the medium of communication and collaboration between discrete independent microservices,” Singh says. “They either live in a bigger ecosystem of applications, or they provide one independent discrete service from anywhere, as and when required.”
[ Evangelizing cloud-native development to the rest of the organization? You’ll probably need to explain APIs in plain English. ]
Given the interdependent nature of APIs and microservices, it’s wise to watch out for current and emerging trends in how they work together, especially as more IT teams shift away from monolithic development to more modern approaches. We checked in with some experts to ask for the most important trends and concepts that should be on your radar.
1. Declarative APIs for the win
While APIs and microservices go hand-in-hand, it’s specifically “declarative” APIs – as opposed to the other primary type of API, the “imperative” API – that are helping to make microservices architectures more feasible.
Let’s start with a quick definition of a declarative API, from Barry Walker, software architect at CYBRIC: “A declarative API indicates what the developer is trying to achieve, as opposed to an imperative API, which indicates precisely how it’s to be done. It’s more of a high-level construct.”
Declarative APIs help make this approach efficient, especially as your microservices scale; they also make sense for the inherently decoupled nature of microservices development and distributed systems in general.
“The appeal of declarative APIs is that a developer shouldn’t care about ‘how’ something is done. That is the responsibility of underlying infrastructure,” Walker says. “We build microservices to be loosely coupled, which means that services should not know much about the inner workings of other services. The way this is done is with declarative APIs. It allows us to build flexible and resilient systems using independent services.”
2. The rise of the "desired state" paradigm
The shift toward declarative APIs reflects a broader interest in defining the desired state of a system or environment rather than defining every step in the “how” of that desired state.
“Software architects love the elegance of microservices, but wrangling all the individual components is a real challenge,” says Nate Berent-Spillson, senior director of delivery at Nexient. “That’s why orchestration frameworks like Kubernetes are getting so much traction. They make microservices architectures practical at enterprise scale.”
It’s the declarative approach that powers this practicality.
“Rather than make users explicitly define the steps it should take to maintain state, [Kubernetes] allows them to simply declare what they want to achieve. When it detects conditions outside the desired state, it automatically takes steps to bring them back in line,” Berent-Spillson explains. “It’s a powerful paradigm for complex, fast-changing IT environments like you find with cloud and microservices, where it’s becoming all but impossible for IT staff to make the necessary adjustments by hand.”
And once IT teams discover a good thing, they’re going to want more of it.
“Now that people are seeing this declarative approach to service orchestration, you’re going to start seeing broader support for the ‘desired state’ paradigm applied more broadly,” Berent-Spillson predicts.
Subscribe to our weekly newsletter.
Keep up with the latest advice and insights from CIOs and IT leaders.