Benefits of a Microservice Architecture
- Individual microservices within an application can be developed and deployed through different technology stacks.
- Each microservice can be optimized, deployed or scaled independently.
- Better fault handling and error detection.
Components of a Microservice Architecture
- Containerization (through platforms like Docker) - for effective management and deployment of services by breaking them into multiple processes.
- Orchestration (through platforms like Kubernetes) - for configuration, assignment and management of available system resources to services.
- Service Mesh (through platforms like Istio) - for inter-service communication through a mesh of service- proxies to connect, manage and secure microservices.
Complexities of a Microservice Architecture
Let us understand this by how a shopping cart works on a Microservice Architecture. Microservices here would relate to the inventory database, the payment gateway service, the product suggestion algorithm based on the customer's access history, etc. While all these services remain a stand-alone mini-module theoritically, they do need to interact among each other. It is important to note that a service-to-service communication is what makes microservices possible.
Why do we need a Service Mesh?
- Maintain, Configure and Secure all service-to-service communications among all or selected Microservices of an Application.
- Configure and perform network functions within Microservices such as network resiliency, load balancing, circuit breaking, service discovery, etc.
- Network functions are maintained and implemented as a separate entity from the Business Logic, fulfilling the need of a dedicated layer for service-to-service communication decoupling from application code.
- As a result, developers can focus on the Application's Business Logic, while all or most of the work related to network communication is handled by the Service Mesh.
- Since a Microservice to Service Mesh proxy communication is always on top of standard protocols such as HTTP1.x/2.x, gRPC, etc., developers can use any technology to develop individual services.
Components of a Service Mesh Architecture
This contains the core application logic and the underlying code of a microservice. A business logic also retains the application's computation as well as the service-to-service integration logic. Due to the beauty of a Microservice Architecture, the business logic can be written on any platform and remains completely independent from a different service.
This includes basic network functions used by a microservice to initiate a network call and connect with the service mesh sidecar proxy. Though major network functions among Microservices are handled through the Service Mesh, a given service must contain the basic network functions to connect with the sidecar proxy.
Unlike Primitive Network Functions, this component through a service proxy maintains and manages critical network functions including circuit breaking, load balancing, service discovery, etc.
All service mesh proxies are centrally managed and controlled by a Control Plane. Through a Control Plane, you can specify authentication policies, metrics generation, and configure service proxies across the mesh.
Implementing Service Mesh with Istio
Core Capabilities of Istio
- Secure service-to-service communication through authentication and authorization.
- Implement policy layers supporting access controls, quotas and resource allocation.
- Automatic load balancing for HTTP, gRPC, WebSocket, and TCP traffic.
- Automatic metrics, logs, and traces for all traffic within a cluster, including cluster ingress and egress.
- Configure and control of inter-service communication through failovers, fault injection and routing rules.
- Implement policy layers supporting access controls, quotas and resource allocation.
- Service deployment on Kubernetes
- Services registered with Consul
- Services running on individual virtual machines
Core Istio Components
- The data plane consists of the sidecar service proxies (through Envoy), while sidecar communication among microservices is achieved through a policy and telemetry hub (through Mixer).
- The control plane manages and configures communication among all sidecar proxies through Pilot, Citadel and Galley. While Pilot enforces routing rules and service discovery of Envoy proxies, Citadel acts as the authentication and authorizing channel. Galley, on the other hand, acts as Service Mesh's configuration validation, ingestion, processing and distribution component.