Microservices in GO
SHAKIL AKHTAR
A World of Microservices
Monolithic vs Microservices
Monolithic Microservices
Monolithic Microservices
Product
Inventory
Orders
Account
Data
Access
Web
Layer
DB
Gate
way
Inventory
Orders
Account
Product
Client
Client
Client
Monolithic Architecture drawbacks
● Huge code base
● Hard to manage
● Difficult Continuous Integration
● Difficult application Scaling
● And so on...
Go… Microservices
Autonomous
Small
Focused
Benefits of Microservices
● Mixed Technology can be used
● Resilience
● Ease of Deployment
● Composability
● Replaceable
A Good Service
Loose Coupling
High Cohesion
Shared & Hidden Models
Hammer on Approach
Start from Monolith Application
&
Split Later (Refactoring)
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
A Technical Dive
● Service Discovery
● Load Balancing
● Timeouts & Exceptions
● Rate Limiting
● Caching
● Failure Detection
● Metrics & Tracing
● Versioning
● Context Propagation
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 requirements
o double-up the infrastructure & load balance service
Clients
Micro service
Protect your stuff
● Service Accessibility(Authentication)
o OAuth, Goauth2
● Authorization
o ACL, JWT etc.
Clients
Micro service Micro service
Authentication
See no evil, hear no evil
● While Monitoring you need tools like
o Aggregating logs are difficult for 100 of
microservices Logger
● Performance Monitoring
o Easy for single service
o What about if many?
Clients
Micro service
Logging
Performance
Auth Micro
service
Authentication
Garfana
Trace with ZipKin
logging
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
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
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
Logging
Performanc
e
Auth Micro
service
Service
Discovery
Micro
service
Events
Queue
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
Rate Limiting
Caching
Versioning
Custom Router
Demo
Summary
microservices
Microservices constructs
?
Thank You!

Microservices in GO lang