What are microservices?

Microservices are a modern software architecture design where an application is split into many small services allowing teams to innovate faster and achieve massive scale.

Learn more about GitLab

From monolith to microservices

monolith vs microservices

Microservices architecture is most commonly understood by comparing it to a legacy "monolith" application architecture. With a monolith, all of the components are part of a single unit. With microservices, each component is broken out and deployed individually as a services. Services communicate with each other via API calls.

With a monolithic application everything is developed, deployed, and scaled together. The app must be written in a single language, with a single runtime. Different teams working on different parts of the app need to coordinate in order to make sure they don't affect each other's work. For example, one part of the app my depend on a module that needs a specific version say 1.8, which another teams 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, everything is deployed as a single application so code must be tested and deployed together.

Components of a microservice

While every organization defines microservices differently, Martin Fowler's quintessential article on microservices defines 9 components that most microservice architectures have in commons.

  1. Componentization via Services
  2. Organized around Business Capabilities
  3. Products not Projects
  4. Smart endpoints and dumb pipes
  5. Decentralized Governance
  6. Decentralized Data Management
  7. Infrastructure Automation
  8. Design for failure
  9. Evolutionary Design

Folwer goes into detail during this talk at GOTO;

Engineering benefits of microservices

Building applications with a microservices architecture, or decomposing a legacy monolith into microservices increases velocity, flexibility, and scalability, at the cost of simplicity. Monoliths are simple to build, deploy, and debug, but are very hard to scale. By using a more complex microservice architecture engineering organizations gain several benefits

  1. Services can scale independently.
  2. Individual services can fail without taking down the entire application.
  3. Teams can choose their own technology stack to that can be different from other services.
  4. Functionality can be tested and swapped more easily.
  5. Developer productivity: individual teams can move faster.

Business value of microservices

  1. Faster pace of innovation.
  2. Greater stability/resiliancy (less loss of revenue due to downtime)
  3. Greater scale, the software is able to keep up with business demand.
  4. Lower costs. Since infrastructure can be tailored to specific services less overall infrastructure is needed to run the application saving costs.

Using GitLab with microservices

  1. Built-in CI/CD: As Fowler points out, infrastructure automation using continuous delivery and deployment is necessary for microservices. GitLab's build-in CI/CD is ideal for businesses looking to leverage microservices.
  2. Built-in container registry and tight 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 successful operation. GitLab built-in monitoring capabilities leveraging Prometheus make GitLab ideal for microservices.
  4. Multi-project pipelines support running pipelines with cross-project dependancies
  5. Monorepo support with the ability to run a pipeline only when code in a specific directory changes.
  6. [Group-level Kubernetes clusters] allows multiple projects to integrate with a single Kubernetes cluster.

Getting even better

While GitLab is great for microservices today, there are several features on the roadmap to make it even better.

Additional resources