Microservices in GO lang

28
Microservices in GO SHAKIL AKHTAR

Transcript of Microservices in GO lang

Page 1: Microservices in GO lang

Microservices in GO

SHAKIL AKHTAR

Page 2: Microservices in GO lang

A World of Microservices

Page 3: Microservices in GO lang

Monolithic vs Microservices

Monolithic Microservices

Page 4: Microservices in GO lang

Monolithic Microservices

Product

Inventory

Orders

Account

Data Access

Web Layer

DBGateway

Inventory

Orders

Account

Product

Client

Client

Client

Page 5: Microservices in GO lang

Monolithic Architecture drawbacks● Huge code base

● Hard to manage

● Difficult Continuous Integration

● Difficult application Scaling

● And so on...

Page 6: Microservices in GO lang

Go… Microservices

Autonomous

Small

Focused

Page 7: Microservices in GO lang

Benefits of Microservices● Mixed Technology can be used● Resilience● Ease of Deployment● Composability● Replaceable

Page 8: Microservices in GO lang

A Good ServiceLoose Coupling

High Cohesion

Shared & Hidden Models

Page 9: Microservices in GO lang

Hammer on Approach

Start from Monolith Application

&

Split Later (Refactoring)

Page 10: Microservices in GO lang

Building Microservices in GO● Business Domain Centric ● Build a Great Wall of China. Protect Stuff with security. ● See no evil, hear no evil● Discover your services● Gateway your watchman● Messaging/events● Think serverless architecture

Page 11: Microservices in GO lang

A Technical Dive● Service Discovery ● Load Balancing● Timeouts & Exceptions● Rate Limiting● Caching● Failure Detection● Metrics & Tracing● Versioning● Context Propagation

Page 12: Microservices in GO lang

Business Domain Centric● Automated deployment

o Also good for monolith applications● Exposure to other systems

o Endpoints● Provisioned storage

● If any● Scalability and load balance

o Depending on resiliency requirementso double-up the infrastructure & load balance service

Clients

Micro service

Page 13: Microservices in GO lang

Protect your stuff● Service Accessibility(Authentication)

o OAuth, Goauth2● Authorization

o ACL, JWT etc.

Clients

Micro service Micro service

Authentication

Page 14: Microservices in GO lang

See no evil, hear no evil● While Monitoring you need tools like

o Aggregating logs are difficult for 100 of microservices Logger

● Performance Monitoringo Easy for single serviceo What about if many?

Clients

Micro service

Logging

Performance

Auth Micro service

Authentication

Page 15: Microservices in GO lang

Garfana

Trace with ZipKinlogging

Page 16: Microservices in GO lang

Discover your services● Service Registry

o Search your services● Abstract the registry

o A new component● Help identifying decommissioned services● Versioning ● Help in preparing dependency graph

Clients

Authentication

Micro service

LoggingPerformance

Auth Micro service

Service Discovery

Micro service

Page 17: Microservices in GO lang
Page 18: Microservices in GO lang

Gateway your watchman● Generalized security● Performance Metrics cloud be ● recorded for all requests● Auditing● Request Transformation● Routing & Combination

Clients

API Gateway

Authentication

Micro service

LoggingPerformance

Auth Micro service

Service Discovery

Micro service

Page 19: Microservices in GO lang

Events● Task Scheduling

o Simple by dropping events● Subscribe for specific events

o Your message handler becomes simple microservice

● Expose your subscribe functionality to external Clients to handle various notifications

Clients

API Gateway

Authentication

Micro service

LoggingPerformance

Auth Micro service

Service Discovery

Micro service

Events

Queue

Page 20: Microservices in GO lang

Think serverless architecture● Standardize your microservices● Focus on your processing routine not on writing microservices always● FaaS● Reduce cost● Easy to scale independent services triggered to action by events

Page 21: Microservices in GO lang

Rate Limiting

Page 22: Microservices in GO lang

Caching

Page 23: Microservices in GO lang

Versioning

Page 24: Microservices in GO lang

Custom Router

Page 25: Microservices in GO lang

Demo

Page 26: Microservices in GO lang

Summarymicroservices Microservices constructs

Page 28: Microservices in GO lang

Thank You!