1 Microservices at a glance


This chapter covers

  • Understanding microservices and their core characteristics
  • Examining the benefits and drawbacks of microservices
  • An example of microservices working in concert to serve a user request
  • Using ASP.NET for a simple application

In this chapter, I’ll explain what microservices are and demonstrate why they’re interesting. We’ll also look at the six characteristics of a microservice. Finally, I’ll introduce you to the most important technologies we’ll use in this book: ASP.NET and ASP.NET MVC.

1.1 What is a microservice?

A microservice is a service with one, and only one, very narrowly focused capability that a remote API exposes to the rest of the system. For example, think of a system for managing a warehouse. If you broke down its capabilities, you might come up with the following list:

  • Receive stock arriving at the warehouse.
  • Determine where new stock should be stored.
  • Calculate placement routes inside the warehouse for putting stock into the right storage units.
  • Assign placement routes to warehouse employees.
  • Receive orders.
  • Calculate pick routes in the warehouse for a set of orders.
  • Assign pick routes to warehouse employees.

Let’s consider how the first of these capabilities—receive stock arriving at the warehouse—would be implemented as a microservice. We’ll call it the Receive Stock microservice:

1.2 What is a microservices architecture?

1.2.1 Microservice characteristics

1.3 Why microservices?

1.3.1 Enabling continuous delivery

1.3.2 High level of maintainability

1.3.3 Robust and scalable

1.4 Costs and downsides of microservices

1.5 Greenfield vs. brownfield

1.6 Code reuse

1.7 Serving a user request: An example of how microservices work in concert

1.7.1 Main handling of the user request