Date post: | 15-Apr-2017 |
Category: |
Technology |
Upload: | nklmish |
View: | 2,219 times |
Download: | 2 times |
@nklmish
MicroserviceNo fluff, the REAL stuff
The best preparation for tomorrow is doing your best today
@nklmish
@nklmish
Agenda
Common Problems
Microservice - core concepts
Pros & Cons
Code
@nklmish
About me
Senior Software developer at 4FinanceIT
Consultant and architect around JVM technology
@nklmish
Monolithic ?
@nklmish
Common Problems
@nklmish
Too much complexity needs to be exposed
@nklmish
legacy components - Hard to upgrade
@nklmish
Workaround
@nklmish
New functionality can just pop
@nklmish
Easy to maintain standards, hard to maintain quality
@nklmish
Easy to maintain quality, hard to maintain standards
@nklmish
Refactoring
(Before)
@nklmish
Refactoring
(After)
@nklmish
Microservices
@nklmish
Microservices
1
Application
2 3 4 5
6 7 8 9 N
@nklmish
Core Concepts
@nklmish
Concept 1 : Service Registry
@nklmish
Service Registry
Zookeeper Eureka ConsulConsistency
Partition
Availability
PartitionAvailability
Partition
@nklmish
Eureka
Components:
Server - REST service
Client - Java component (Used within a microservice)
@nklmish
Eureka Client Server CommunicationClien
t
Serv
er
Registration: first heartbeat (after 30s)
Renew lease: heartbeat/30s
Fetching Registry: retrieve & cache it locally
Registry Update: /30s
Shutdown: Cancel request on shutdown
Renew fail
ure:
No heart
beat for
90s,
REMOVE
Shutdow
n:
Removes
instance
from reg
istry
@nklmish
Concept 2 : Load balancing
@nklmish
Ribbon
Client side load balancer
Built-in Failure resiliency
Rule based load balancing
@nklmish
Concept 3 : Edge Service
@nklmish
Zuul
Error
RoutingPre PostRequest
Response
@nklmish
Zuul features
Load Shedding
Authentication & Security
Static Response handling
Surgical Debug Filter
Stress Testing
@nklmish
Concept 4 : Failure management
@nklmish
Hystrix
Manage failures(latency + fault tolerance)
Cascading failures
Fail fast approach
@nklmish
Pros & Cons
@nklmish
Pros
Component
Richer tech stack
Scalability
Resilience
@nklmish
Cons
Distributed system.
Arsenal of tools (Infrastructure)
Testing
Transactions
@nklmish
DEMO
@nklmish
Demo
Spring Cloud OSS
http://tiny.cc/micro-code
@nklmish
Spring Cloud
@nklmish
DEMO
CATALOG SERVICE
PRODUCT SERVICEPRICE
SERVICECOMMENT SERVICE
@nklmish
Microservice in REAL life
@nklmish
Metrics