What are microservices and why do they matter?

Microservices are component parts of an application that are designed to run independently. A microservices-based application is a collection of loosely coupled services that are lightweight and independently deployable and scalable. Because each microservice is modular and runs its own processes, it can be modified without affecting the entire application.

The use of microservices is sometimes referred to as cloud native. However, cloud native application development encompasses modern software development practices and the use of containers along with orchestration and other tools in addition to microservices. A commonly accepted definition of cloud native applies to applications that use microservices packaged and deployed in containers and managed on scalable cloud infrastructure through agile DevOps processes and continuous delivery workflows.

As companies increasingly choose a hybrid multi-cloud strategy for application deployment, they are relying on containerized microservices for application portability across on-premises and public cloud. Because of the portability that containers provide and the agility that microservices afford, many companies are leveraging a cloud native approach to get their products and services to market faster to gain or maintain a competitive advantage.

Explore additional microservices topics

Why are microservices being adopted?

Organizations are moving to microservices to take advantage of the agility benefits they provide. Because each microservice can be developed, deployed, and scaled independently, IT teams can quickly make changes to any part of an application to get products and services to market faster and stay ahead of their competitors.

And since microservices are device and platform agnostic, organizations can develop applications that provide consistent user experiences regardless of the underlying infrastructure.

When adopting microservices and modernizing their application architectures, organizations also need to modernize their application delivery. An application delivery controller (ADC) is key for improving the availability, performance, and security of microservices-based applications.

Citrix offers production-grade, fully supported application delivery solutions that provide the most comprehensive integration with Kubernetes platforms and open source tools, greater scale and lower latency, consistent application and API security, and a holistic observability stack.

How do microservices work?

A microservice is a modular component of an application. Many hundreds or thousands of microservices can make up a single application. Microservices have the following characteristics:

  • All microservices run their own processes and communicate with other components and databases via their respective application programming interfaces (APIs).
  • Microservices use lightweight APIs to communicate with each other over a network
  • Because microservices are individually developed and maintained, each microservice can be modified independently without having to rework the entire application.
  • Every microservice follows a software development lifecycle designed to ensure that it can perform its particular function within the application.
  • Each microservice performs a specific function, such as adding merchandise to a shopping cart, updating account information, and transacting a payment.
  • The functionalities of numerous microservices may be exposed and orchestrated by the application’s API, enabling application development teams to reuse portions of an existing application to build new applications without starting from scratch. 

It is not necessary for all microservices in an application to be written in the same programming language or by the same development team. When building microservices-based applications, many developers choose to use open source tools, which are published by their creators to publicly available repositories such as GitHub. Still other developers prefer a mix of open source tools and commercial off-the-shelf software.

What are the primary types of microservices?

Microservices may be stateful or stateless.

Stateful Microservices

A stateful microservice records the state of data after an action for use in a subsequent session. For example, online transaction processing such as bank account withdrawals or changes to an account’s settings are stateful because they must be saved so that they persist across sessions. These stateful components are somewhat complex to manage, since they need stateful load balancing and can only be replaced by other components that have saved the same state.

Stateless Microservices

A stateless microservice doesn’t store anything. Its outputs depend solely on events rather than any saved data. In cloud environments, stateless microservices are usually preferable because they can be spun up only as needed and are fully interchangeable with one another. That reduces complexity and avoids the need to pre-commit compute, storage, and networking resources.

What’s the difference between an API and a microservice?

In a microservices architecture, an application is built with many small, discrete services called microservices. An application programming interface, or API, serves as the application’s gateway and enables microservices to communicate with each other.

APIs

An API is an interface that a client or application calls to use the functionality of a web service or microservice (or another application). When an API is called, the requester is asking for access to specific data and/or for particular actions to be performed.

For example, when you want to watch a movie on a subscription streaming platform, API calls are made when you log in to your account and select a movie. These actions in turn require corresponding microservices to run. A single API call may bundle multiple requests to microservices. In this sense, an API is similar to the front door of a house that is filled with microservices.

Microservices

Microservices are lightweight modular components, or services, that perform unique functions within an applications. A microservices-based application typically contains numerous microservices and APIs. It may also use an API gateway to provide a single point of entry for requests made to a defined group of microservices.

Microservices each have their own APIs, which manage requests over a protocol such as HTTP to communicate with one another and with the application as a whole.

How do microservices differ from monoliths?

By comparing microservices to the monolithic systems that they supersede or coexist with at many organizations, it can be easier to understand their distinctive characteristics and benefits.

The monolithic approach

As the name implies, monolithic applications incorporate a unified approach to architecture. All the components in a tightly coupled monolithic architecture are interconnected and interdependent.

Benefits of Monoliths

  • Monolithic applications are relatively simple to build. Developers can use the classes and functions of a programming language or languages to establish and separate the different functions of the application and run everything in the same process.
  • Monolithic applications are also typically straightforward to test. The entire application can be tested for errors and proper functionality as one unit.
  • Deploying monolithic applications is typically straightforward as well. A fully packaged monolith can be deployed on a server and then scaled horizontally to meet demand by deploying copies of the application to additional servers behind a load balancer.

Drawbacks of Monoliths

  • Since monolithic applications have one large codebase, even the smallest change may require that the entire application be tested before being redeployed.
  • A bug or a failure can affect the entire application because functions and services are tightly coupled.
  • Scaling can be a challenge with monolithic applications because they have a single codebase, so developers must coordinate on changes.
  • Monolithic application architectures make it difficult to adopt new technologies for application deployment and delivery because changes to frameworks or languages impact the entire application.

The microservices approach

Microservices are not a new take on application development: They have roots in the design principles of Unix-based operating systems and in the popular service-oriented architecture (SOA) model. SOA introduced the concept of independent services that can access software, perform business functions, and enable general modularity and reuse across IT.

Microservices extend this concept by allowing applications to be broken down into many autonomous components that can be wholly managed by small teams of developers – an ideal situation for IT organizations looking to make complex applications more agile and easier to manage with fewer developer resources.

Benefits of microservices

  • Each microservice can be built and deployed independently, allowing for more rapid releases. Moreover, work can be spread across multiple teams, and key components can be easily shared and reused.
  • Once updates pass automated testing, they move into production as part of a reliable and efficient change process.
  • Microservices can be easily scaled as needed since each microservice is a separate module.
  • Because microservices are independent from each other, developers are not limited to using the same frameworks and languages.

Challenges of Microservices

  • With the rapid pace of continuous integration and continuous delivery, teams can be challenged with the frequent release cycles.
  • Testing can be complex because each microservice has its own dependencies.
  • Holistic monitoring is critical for pinpointing issues when a service fails or a server goes down.
  • Managing at scale requires automated processes and tools

What new challenges do microservices create for application delivery?

Microservices are packaged in containers that are most commonly managed with Kubernetes, an open source platform for container orchestration. Because Kubernetes environments are inherently difficult to deploy and troubleshoot and since IT skill sets vary greatly, many organizations struggle to deploy microservices-based applications quickly and reliably.    

Managing application delivery for microservices-based applications presents challenges for teams who want to:

  • Choose the right architecture for providing the greatest benefits relative to the complexity of implementation and available skill sets.
  • Gain visibility into microservices at scale.
  • Achieve better performance and scale for large clusters with lower memory footprint, lower latency, and higher performance.
  • Eliminate the observability blind spot for east-west traffic between microservices.
  • Ensure a consistent security posture across all microservices and APIs, including for ingress (north-south) traffic and intra-cluster (east-west) traffic.

Citrix offers production-grade, fully supported application delivery solutions that integrate with your preferred Kubernetes platform and open source tools.

How do microservices work with containers?

Containerization is a form of operating system virtualization. Individual containers include a full runtime environment with everything an application needs to function, namely its libraries, configuration files, and dependencies. All of these essential pieces are abstracted from the underlying infrastructure, allowing the containerized software to be fully portable across disparate environments.

Microservices can be containerized to achieve:

  • A smaller memory footprint than if they were run in virtual machines.
  • More consistent, predictable performance across hybrid multi-cloud environments.
  • Less latency and improved scalability for better overall application experience.

Citrix ADC CPX is a container-based application delivery controller that can be provisioned on a Docker host to support cloud native deployments that leverage microservices and containers.

Who benefits most from the use of microservices?

First and foremost, the use of microservices benefits organization by helping them realize their business objectives, whether they be broad (digital transformation) or specific (refactoring an on-premises legacy application to run more efficiently in cloud). Software development teams and end users and customers also benefit from microservices, but in different ways.

Organizations

Because microservices are modular, loosely coupled services with lightweight protocols, they are easier to develop, test, and deploy—and also easier to change and maintain. By developing applications using microservices that can be independently tested and deployed, organizations don’t need to rewrite their entire codebases to add or modify a feature, which enables them to get their products and services to market faster.

Developers

For developers, microservices offer the chance to focus on specific functions performed by the application rather than the entire application. This approach can boost productivity by allowing for more rapid development within a narrow scope. Developers who work within the agile and/or DevOps paradigms can move more quickly thanks to the faster release cycles afforded by microservices.

End users and customers

When a monolithic application has to be rebuilt or redeployed to fix even the smallest error, the user experience can suffer. With microservices-based applications, changes can be made, tested, and released quickly. For end users and customers, there should be no discernible difference between a microservices-based and monolithic application. Better application performance and a consistent user experience is possible through the use of Citrix ADC, an application delivery solution that supports both monolithic and microservices-based application delivery in hybrid multi-cloud environments.

Additional resources

Next step