Microservices V2 Presentation
Microservices V2 Presentation
Microservices V2 Presentation
1
Microservices - V2
V2 - Latest Releases of
Spring Boot
Spring Cloud
Docker and
Kubernetes
Skip to Next Section :)
V1 - Old Versions
Spring Boot v2.3 and LOWER
Continue on to next lecture :(
2
Microservices - V2
You have skipped V1
Go to next lecture!
You have completed V1
Option 1: Start from Zero Again:
Go to the next lecture!
Option 2: Get a Quick Start:
Jump to "Step 21 - QuickStart by Importing
Microservices"
Same microservices as V1: Currency Exchange and
Currency Conversion
Very little changes in Eureka Naming Server
Step 21 helps you set these up and get started quickly!
3
Microservices - V2 - What's New
Microservices Evolve Quickly
Important Updates:
Latest Versions of Spring Boot & Spring
Cloud
Spring Cloud LoadBalancer instead of Ribbon
Spring Cloud Gateway instead of Zuul
Resilience4j instead of Hystrix
Docker: Containerize Microservices
Run microservices using Docker and Docker
Compose
Kubernetes: Orchestrate all your
Microservices with Kubernetes
4
Monolith
5
Microservices
6
What is a Microservice?
Sam Newman
7
What is a Microservice?
8
Microservices for me
REST
Small Well Chosen Deployable
Units
Cloud Enabled
9
Microservices - Challenges
Bounded Context
Configuration Management
Dynamic Scale Up and Scale Down
Visibility
Pack of Cards
Zero Downtime Deployments
10
Microservice - Solutions
11
Microservices - 3 Key Advantages
12
Ports Standardization
Application Port
Limits Microservice 8080, 8081, ...
Spring Cloud Config Server 8888
Currency Exchange Microservice 8000, 8001, 8002, ..
Currency Conversion Microservice 8100, 8101, 8102, ...
Netflix Eureka Naming Server 8761
API Gateway 8765
Zipkin Distributed Tracing Server 9411
13
Need for Centralized Configuration
Lot of configuration:
External Services
Database
Queue
Typical Application Configuration
Configuration variations:
1000s of Microservices
Multiple Environments
Multiple instances in each Environment
How do you manage all this
configuration?
14
Config Server
15
Environments 16
Environments
17
Environments
18
Microservices Overview
19
Currency Exchange Microservice
What is the exchange rate of one currency in another?
http://localhost:8000/currency-exchange/from/USD/to/INR
{
"id":10001,
"from":"USD",
"to":"INR",
"conversionMultiple":65.00,
"environment":"8000 instance-id"
}
20
Currency Conversion Microservice
Convert 10 USD into INR
http://localhost:8100/currency-conversion/from/USD/to/INR/quantity/10
{
"id": 10001,
"from": "USD",
"to": "INR",
"conversionMultiple": 65.00,
"quantity": 10,
"totalCalculatedAmount": 650.00,
"environment": "8000 instance-id"
}
21
Naming Server
22
Load Balancing
23
Spring Cloud Gateway
Simple, yet effective way to route to APIs
Provide cross cutting concerns:
Security
Monitoring/metrics
Built on top of Spring WebFlux (Reactive
Approach)
Features:
Match routes on any request attribute
Define Predicates and Filters
Integrates with Spring Cloud Discovery Client (Load
Balancing)
Path Rewriting
From https://docs.spring.io
24
Circuit Breaker
25
Distributed Tracing
26
Distributed Tracing
27
Distributed Tracing - Asynchronous
28
Microservices
29
Docker
Create Docker images for each
microservice
Docker image contains everything a
microservice needs to run:
Application Runtime (JDK or Python or
NodeJS)
Application code
Dependencies
You can run these docker containers
the same way on any infrastructure
Your local machine
Corporate data center
Cloud
30
Traditional Deployment
31
Deployments using Virtual Machines
32
Deployments using Docker
33
Docker Architecture
34
Container Orchestration
Requirement : I want 10 instances of
Microservice A container, 15 instances
of Microservice B container and ....
Typical Features:
Auto Scaling - Scale containers based on
demand
Service Discovery - Help microservices find
one another
Load Balancer - Distribute load among
multiple instances of a microservice
Self Healing - Do health checks and replace
failing instances
Zero Downtime Deployments - Release new
versions without downtime
35
Container Orchestration Options
AWS Specific
AWS Elastic Container Service (ECS)
AWS Fargate : Serverless version of AWS ECS
Cloud Neutral - Kubernetes
AWS - Elastic Kubernetes Service (EKS)
Azure - Azure Kubernetes Service (AKS)
GCP - Google Kubernetes Engine (GKE)
EKS/AKS does not have a free tier!
We use GCP and GKE!
36
Kubernetes Architecture
37
Kubernetes Architecture
38
Kubernetes Architecture
39
Kubernetes Architecture
40
Kubernete Deployments
41
Kubernete Deployments
42
Kubernete Deployments
43
Kubernete Service
44
Kubernetes - Liveness and Readiness Probes
45
What Next?
46
Docker & Kubernetes in Depth
47
Full Stack
48
AWS Certifications
49
Serverless
50