Summary

In this chapter, we started with the definition of microservices. The main difference between a monolith application and a microservice is the way tightly coupled architecture is broken into loosely coupled architecture. Microservices talk to each other using either REST-based JSON or RPC-based protocol buffers. Using microservices, we can break business logic into multiple chunks. Each service does one job pretty well. This approach comes with a disadvantage. Monitoring and managing microservices is painful. Go provides a wonderful toolkit called Go Kit. It is a microservices framework using which we can generate boilerplate code for microservices.

We need to define a few things in Go Kit. We need to create implementations, endpoints, and models for a Go-Kit service. Endpoints take requests and return responses. Implementations have the actual business logic of services. Models are a nice way to decode and encode request and response objects. Go Kit provides various middleware for performing vital tasks such as logging, instrumentation (metrics), and service discovery.

The small organizations can start with a monolith, but in bigger organizations with huge teams, microservices suit better. In the next chapter, we can see how to deploy our Go services using Nginx. A service needs to be deployed for it to be exposed to the outside world.

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

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