Microservices Architecture with GCP

Every day, we probably use a service based on a microservices architecture. Every time we watch a Netflix series, we essentially use a service based on a microservice. A microservice offers more advantages than a classic architecture and is perfect for a

  • PDF / 771,998 Bytes
  • 17 Pages / 504 x 720 pts Page_size
  • 97 Downloads / 236 Views

DOWNLOAD

REPORT


Microservices Architecture with GCP Every day, we probably use a service based on a microservices architecture. Every time we watch a Netflix series, we essentially use a service based on a microservice. A microservice offers more advantages than a classic architecture and is perfect for a cloud application. In this chapter, you will learn how to design a microservices architecture and how to implement it in Google Cloud Platform (GCP).

Introduction to Microservices Architecture Microservices architecture is a programming technique derived directly from service-­ oriented architecture (SOA). Microservices architecture is, in fact, a variation of that style of architecture. In microservices architecture, we create services that are loosely coupled, fine-grained, and connected with a lightweight protocol. A loosely coupled service doesn’t have to know more about the definition of the other services. It needs to know only how to call and what it gets back; no other details are needed. This means that we can change the implementation of the service without any problems. The service is normally fine-grained. Granularity is a key consideration that must be made when we design a service, as it defines the business functionality and the payload message between the services. In a fine-grained service, we can define a small business case in which the payload message can be big or small. This depends on how many transactions we have. For example, we can define a microservices user for which we define the interface for creating and reading the user.

© Pierluigi Riti 2018 P. Riti, Pro DevOps with Google Cloud Platform, https://doi.org/10.1007/978-1-4842-3897-4_6

147

Chapter 6

Microservices Architecture with GCP

Adopting a microservices architecture helps to decompose big architecture into smaller pieces. This helps to improve the scalability of the architecture. Microservice is normally deployed with a container architecture. This means that we can add services to respond to the high traffic and remove them when they are no longer needed. Another advantage of this architecture is that it allows the team to write code in parallel and deploy it independently. This is because, for the test, we just need to know the data for the input and the data we receive from the output. Because the entire service is independent, we can, and must, implement the continuous integration and deployment easily. For microservice to be successful, it is essential to adopt continuous integration and deployment. Following are some principles associated with microservices architecture: •

Microservices is designed for big systems: A microservice is born of the necessity to scale a big system, but how a big system is defined is relative. The important idea behind microservices is to design a system to be reactive to changes and improve scalability of the system itself.



Microservices is goal-oriented: When we design a microservices architecture, we don’t have to follow set rules, but we can devise solutions tailored to resolve specific proble