What are microservices?

A microservices architecture splits an application into many small services allowing teams to innovate faster and achieve massive scale.

Join our cloud transformation webcast

Moving from monolith to microservices

You can understand microservices architecture by comparing it to a legacy monolith application architecture. With monolithic architecture, all the components are part of a single unit. It develops, deploys and scales everything together. Teams must write the app in a single language with a single runtime.

Different teams working on different app components must coordinate, so they don't affect each other's work. For example, one part of the app may depend on a module that needs a specific version, say 1.8, while another team needs the same module but requires the 1.7 version because 1.7 is incompatible with another dependency. In a monolithic app, you have to pick one or the other. Similarly, monolithic apps deploy everything as a single application, requiring testing and deploying code together.

With microservices, each component is broken out and deployed individually as services and the services communicate with each other via API calls.

A monolith vs microservice architecture

Microservice core components

Microservices maximize application reliability and deployment velocity. This is particularly important in a marketplace that's moving and evolving faster than ever. Microservices' containerized architecture moves apps anywhere without altering or disrupting the environment, facilitating speed and reducing downtime.

Let's look at microservices' core components:

  1. Clients: Client apps usually must consume functionality from multiple microservices and require frequent updates.
  2. Databases: A service API updates microservices databases by carrying all remote services supporting inter-process communications for different stacks.
  3. API gateway: An API gateway is a microservices design pattern that's a vital single app entry point for routing requests and protocol translation.
  4. Identity providers: An identity microservice must permit server-to-server and user-driven access to identity data.
  5. Messaging formats: Microservices communicate with synchronous or asynchronous microservice architecture patterns.
  6. Static content: Clients receive static content via cloud-based storage services and content delivery networks.
  7. Management: This component allows business users to configure services during run-time.
  8. Service discovery: A service discovery mechanism is required to request service.

Microservice characteristics

Martin Fowler's quintessential article on microservices defines nine components that most microservice architectures have in common. .

1. Componentization via Services

Microservice's nature dictates breaking down each component by service. As such, it can designate, deploy, refine and redeploy each service independently without affecting the environment. This means it's usually possible to change a service instead of redeploying an entire app.

2. Organized around Business Capabilities

With the monolithic approach, tech teams focused separately on tech-related capabilities such as UI, databases and server-side logic. On the other hand, microservices organize cross-functional teams around business capabilities and priorities. Each team designs specific products based on individual services that communicate using a message bus.

3. Products not Projects

In the past, app developers used the project model that tasked teams to build software, which then went to a maintenance organization upon completion. Microservices architecture favors a team owning the product over its lifetime.

This allows developers to interact with their products in new ways, seeing how they behave in production and increasing user contact. This benefits engineers and businesses to increase collaboration and understand each other's fields.

4. Smart endpoints and dumb pipes

Microservices have a lot in common with the traditional UNIX system. They receive a request, process it and generate an appropriate response. Fowler refers to this approach as "smart endpoints and dumb pipes." The infrastructure is usually dumb as it serves solely as a message router, and all the smarts reside at the endpoints producing and consuming endpoints.

5. Decentralized Governance

Decentralized governance is microservice architecture's default structure because single-technology platforms often lead to over-standardization. A major advantage of microservices vs. monoliths is using different languages where they're best suited. For example, Spring Boot microservices can build an app for one component, with Spring Cloud comprising another.

6. Decentralized Data Management

Most microservices allow each component to manage its own database from decentralized data management. You can always use the best data store for a specific project while removing the time-consuming task of shared database upgrades.

7. Infrastructure Automation

CI/CD experts use infrastructure automation in microservices. It lessens developers' workloads and significantly improves deployment timeline efficiency.

8. Design for failure

Like the best businesses, microservices have resilience in mind. As unique and diverse services must communicate, failure is likely. This is microservices' main disadvantage compared to monoliths because the solution requires additional complexity.

Sophisticated monitoring and logging setups are necessary to prevent failure from impacting consumers. While this requires more work for engineers, it means fail resistance is well-developed.

9. Evolutionary Design

With such a fast-paced tech industry, evolutionary design is no longer a luxury; it's a necessity. More new electronic device types hit the market each year, and your apps must be ready to facilitate them. Microservices' deconstructed design means you can give apps a makeover without redeployment.

Fowler went into more detail about each of these components in this talk from GOTO.

Microservice architecture use cases

Microservices designs are agile and flexible and enable minimal downtime for maintenance, repairs and updates.

Some key use cases for microservices include:

  1. Data processing: Apps running on microservice architecture can handle more concurrent requests in less time, making them more efficient.
  2. Website migration: Microservices avoid site UI, structure and/or domain site migration downtime.
  3. Large-scale media: Platforms can handle an extreme number of requests for different subdomains without errors or delays.
  4. Invoices and transactions: Microservices can help make transactions more robust with reduced app failure, allowing companies to scale up without redeploying.
  5. Outdated systems: Developing a new containerized system is more efficient and effective than updating old, clunky monoliths.

Engineering benefits of microservices

Implementing a microservices architecture, or decomposing a legacy monolith into microservices, can increase velocity, flexibility and scalability, often at simplicity's cost. Monoliths are straightforward to build, deploy and debug, but hard to scale. While a microservice architecture is more complex, there are several benefits for engineers:

1. Independent deployment

Each microservice must be a full-stack to function correctly. Development teams can easily fix errors on a single microservice without impacting the whole environment.

2. Scalability

Teams building apps with microservices architecture can change each service without disrupting the rest of the app. Programmers can work in parallel to identify hot services, update functionality and scale selected services.

3. Tech stack freedom

Reliance on the singular tech stack is one of monolithic architecture's most limiting features. With microservices, developers can build an app using the programming language, framework, databases and front-end and backend tools. This mitigates compromising on a jack-of-all-trades and master of none standardized stack.

4. Fault isolation

A single fault often means an entire monolith app fails. Microservices isolate faults to their components, so the whole application isn't affected.

5. Productivity

Microservices reduce silos and promote cross-functional teamwork for today's distributed and remote workforces. They can be tested independently while developers handle other aspects, streamlining quality assurance.

Business value of microservices

With business value, microservices have a lot of benefits compared to monoliths. They promote a symbiotic relationship between developers and business leaders, leading to better outcomes. Microservices promote:

  1. Faster pace of innovation. Their evolutionary design makes it easy to change and upgrade application components.
  2. Greater stability/resiliency. Microservices practically eliminate downtime because, unlike monolithic architecture, services are separate and developers can update one component at a time.
  3. Software can scale to keep up with business demand. Development teams can work on single components without impacting the entire environment.
  4. Lower costs and better revenue. Microservices need less overall infrastructure, minimize downtime and improve stability for enhanced customer experience and reduce app prototype to deployment timeframes.

Using GitLab with microservices

With GitLab, you can commit your code and have the tools you need in a single application. No more stitching together 10 tools for every project.

Using a DevOps platform to manage your microservices helps you avoid information silos. Increasing visibility among teams and making handoffs easier leads to a faster DevOps lifecycle while also ensuring that your projects deploy and remain stable.

A few ways GitLab simplifies microservice orchestration include:

  1. Built-in CI/CD: As Fowler points out, infrastructure automation using continuous delivery and deployment is necessary for microservices. GitLab's built-in CI/CD is ideal for businesses looking to leverage microservices.
  2. Built-in container registry and a robust Kubernetes integration: While microservices architecture can be used with legacy VM technology, containers and Kubernetes make building microservices significantly easier. GitLab is designed to work well with Kubernetes.
  3. Built-in Monitoring: Monitoring is critical to a successful operation. GitLab's monitoring capabilities leveraging Prometheus make GitLab ideal for microservices.
  4. Multi-project pipelines support running pipelines with cross-project dependencies.
  5. Monorepo support with the ability to run a pipeline only when code a specific directory changes.
  6. Group-level Kubernetes clusters allow multiple projects to integrate with a single Kubernetes cluster.

GitLab key benefits

GitLab is a single DevOps platform attracting top developers looking to collaborate and improve. Below are some key benefits of becoming a GitLab advocate:

  • No switching between apps - Developers don't need to constantly context-switch, making it easier to focus and stay on task. Additionally, you can easily link issues to work, increase productivity and eliminate software engineers' main bugbears.
  • Reduce your workload - GitLab makes it easier to automate tasks so that you can focus on more demanding, results-based activities. Repetitive manual tasks take the joy out of a developer's workday. Automate tasks to improve work satisfaction and productivity.
  • Collaboration and transparency - Collaboration and transparency are key benefits of the GitLab platform. Abject transparency between developer and customer facilitates collaboration for quick, easy fixes and less communication.
  • Be part of the community - All developers are free to contribute to GitLab's open-source core to improve the app. It's a warm, friendly and highly responsive community that welcomes new community members and helps them learn the ropes.
  • Learn cutting-edge software development practices - Coding and app development is one of the fastest-growing fields in an increasingly fast-paced world. GitLab updates its community on all the latest developments and helps them learn best practices.

Start your cloud native transformation

Build, test, deploy, and monitor your code from a single application.

Hear how Ask Media Group migrated from on-prem servers to the AWS cloud with GitLab tools and integrations. Join us and learn from their experience.

Suggested Content

Free GitLab trial

Unlimited access to all features for 30 days.