What are Microservices?

Microservices is a term used to refer to a service-oriented architecture, in which an application is composed of small autonomous services. These services are very loosely coupled, small (micro), and focused on a single feature of the application.


Image Note

A microservices architecture has also been referred to as “fine-grained SOA.” We will not discuss the differences and similarities between a microservices architecture and service-oriented architecture (SOA) in this book. Both are service architectures dealing with distributed systems communicating over the network. A microservices architecture tends to have a specific focus on incremental evolution over reusability.


Instead of building one single codebase all developers touch, which is often large and risky to manage, the application is composed of smaller codebases independently managed by small agile teams. The only dependency the code bases have on one another is through APIs (application-programmer interfaces). This architectural style has become popular with large-scale web companies like Netflix, eBay, and Amazon. These companies were struggling to scale their applications and, at the same time, bring new features to market rapidly with their existing monolithic architecture. They realized that instead of building one monolithic application, they would build smaller services to handle discrete business functions. The services are self-contained, and the boundaries between the services are well-defined APIs, exposing the business capabilities of the service.

In Figure 1.1, we see a monolithic application with all features and components of the application built and deployed together as a single unit. The monolithic application can be scaled out to multiple instances, but it’s still deployed as a single application.

Image

FIGURE 1.1: A monolith and a microservices high-level structure

A microservices implementation of the application places each of the features in separate services that are built and deployed independently of the other services. Together the independent services provide the functionality of “My Application.” In an ecommerce application this could be the shopping cart, catalog, search, recommendations, account management, checkout, and so on. Team members working on recommendations would not need to concern themselves with all the details of managing shopping carts and purchases. They would likely need information from these services to make good recommendations, but not all the other details for handling the purchase. Each service could use the technologies best suited for each service and can be scaled independently as necessary for the individual service.


Image Flak.io ecommerce Sample

The flak.io microservices sample code uses an ecommerce scenario to demonstrate the concepts discussed in this book. The sample code can be found on GitHub at (https://github.com/flakio).


There are a number defining characteristics commonly present in a microservices architecture. Many of the characteristics that been used to describe microservices are generally in support of loose coupling and small services.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.133.61