2017 02 01 - Bluemix Chicago Meetup - Micrsoservices 101
-
Upload
rick-osowski -
Category
Technology
-
view
84 -
download
2
Transcript of 2017 02 01 - Bluemix Chicago Meetup - Micrsoservices 101
Microservices 101RICK OSOWSKIIBM BLUEMIX CHICAGO MEETUPFEBRUARY 1ST, 2017
AgendaWHAT ARE MICROSERVICESWHY ARE THEY IMPORTANTHOW TO GET STARTEDHOW TO GET THEREQ&A
Who am I?
Rick Osowski Senior Technical Staff Member,
Microservices Adoption IBM Cloud Architecture & Solution
Engineering Based here in Chicago! Twitter: @rosowski GitHub: osowski http://osowski.github.io/
What are microservices?!?
What are microservices?!?
Microservices compose complex distributed applications using “small” independent (autonomous) replaceable processes
that communicate via language-agnostic APIs
which enable agility reliability scalability
Microservice
MicroserviceMicroservice
Microservice
Microservices application
Microservice
Subscribe
REST/HTTP
Microservice
Microservice
broker
API
MicroservicePublish
API
REST/HTTP Publish
ServiceDiscover
y
The genesis of the Enterprise Monolith…
Browser IBM HTTP Server DB2
Database
WebSphere ND
WARStore UI
Catalog Service
Cart Service
Search Service
Orders Service
Services Registry (WSRR)
Inventory Service Order Service
Search Accounts Carts Orders Billing Products Warehouses
Catalog Service
Efficiency & reuse moved towards SOA…
Scale, speed, & strength begot microservices…
• Services manage their own business logic & data stores
• Services access data outside their control through APIs
• Caching used between geographically disparate services
RDBMS
Accounts
Service
RDBMS
Store User
Interface
Recommendation Service Graph
DB
Search Service
Product Details Service
Doc/NoSQL
Orders Service
HadoopShoppin
g Analytics
Cached Calls
Comparing our journey…
Microservices Utility compute Infrastructure Assumes component failure Highly Distributed Eventual consistency Compensation flows Difficult to visualise Component autonomy Network complexity
Traditional Enterprise IT High end compute infrastructure Assumes component availability Mostly centralized Consistent data Transactional Easy to understand dependencies Centralized governance Network connected
How Teams Work How Apps are
Built
How Apps are Delivered
MicroservicesCloud Native
Containers
An engineering approach focused on decomposing an application into single-function modules with well defined interfaces which are independently deployed and operated by small teams who own the entire lifecycle of the service.
Microservices accelerate delivery by minimizing communication and coordination between people while reducing the scope and risk of change.
Microservices
An application architecture designed to leverage the strengths and accommodate the challenges of a standardized cloud environment, including concepts such as elastic scaling, immutable deployment, disposable instances, and less predictable infrastructure.
Cloud Native
A standard way to package an application and all its dependencies so that it can be moved between environments and run without change.
Containers work by hiding the differences between applications inside the container so that everything outside the container can be standardized.
Containers
Let’s build some microservices!
Understand the concepts before the technical implementation…
Service registration and discovery
Required for load balancing and scaling Services need to find each other Environment changes constantly
Client-side or server-side? Client library, sidecar, or proxy?
Microservice
Microservice
Microservice
ServiceRegistry
Client library
ServiceProxy
app
sidecar
Misconception: Microservices and APIs
Microservices are just more fine grained web servicesAPIs are microservices
“micro” refers to the granularity of the components, not the granularity of the exposed interfaces
Monolithic application
Exposed services/APIs
Silocomponent
x 1
x 4
Microservicecomponent
Microservices application
Microservicecomponent
Microservicecomponent
Exposed services/APIs
x 3
x 4
Prevent cascading failures
CIRCUIT BREAKER Wrap remote calls Monitor for failures Notify when circuit is tripped
Use with fallback or retries Decide when/how to reset
Client-side concerns: Make requests easy to retry, throttle, and monitor
client circuit breaker service
Prevent cascading failures
BULKHEAD Ensure at most n threads waiting for
a slow resource Thread isolation
With or without a queue Timeout / fallback
Semaphore isolation Request sent if lock obtained
client
zippymicroservic
e
slowmicroservic
e
slowmicroservic
e
common thread pool
thread pool
Client-side concerns: Make requests easy to retry, throttle, and monitor
Distributed Logging & Tracing
The simplest and most effective debugging tool for a complex microservices web is consistent use of correlation ID’s
Implementing them correctly requires four consistent actions
Create correlation ID if none exists and attach it as a header to every outgoing Service Request
Capture the incoming correlation ID on every incoming request and log it immediately
Attach the correlation ID to the processing of the request (through a threadlocal variable…) and make sure that the same correlation ID is passed on to any downstream requests
Log the correlation id on *any* messages that are connected to that thread of processing
http://opentracing.io provides a vendor-neutral open standard for distributed tracing.
Valuable Resources…
Netflix OSS – Eureka, Ribbon, Zuul, Hystrix, etc. https://netflix.github.io/ && https://cloud.spring.io Java-based with robust community support
Amalgam8 – Polyglot-based alternative to the Netflix stack https://www.amalgam8.io/ External sidecar model with centralized routing fabric
Game On – A throwback text-based adventure built to help you explore microservice architectures
https://game-on.org/ Polyglot-based interactive game designed for you to learn and contribute microservices!
Awesome Microservices – A curated list of microservice related principles and technologies https://github.com/mfornos/awesome-microservices
How to get there?
Raise your hand if you’re working on existing Enterprise applications…
Starting any microservices project…
3 Things…
Understand the Business
Understand the Culture
Understand the Technology
Crawl…
Repackage your application Split up your deployable artifacts Apply a single container per service Build, deploy, & manage independently
Refactor your code Existing REST or JMS services? Existing SOAP or EJB services? Servlets or JSPs?
Walk…
Refactor your data Isolated islands of data Batch data updates Table denormalization
Run…
Iterate, Iterate, Iterate! Macroservices Miniservices Microservices Microservices at scale
Evolving from the named Strangler Pattern
Source: http://tech.gilt.com/2014/11/14/making-architecture-work-in-microservice
Monolith Macroservices Microservices Microservices at scale
A Microservices Case Study
• Luxury brands at members-only prices
• Flash sales daily at Noon ET
• Top 50 Internet Retailer• 150 Engineers
2007 2009 2011 2014
Questions?!?
Thank You!
Please join if you’re not already a member!https://www.meetup.com/bluemix-chicago
Check out my video series on… Microservices for more conversation!https://developer.ibm.com/tv/microservices/
Check out Bluemix for a free trial account to build & play with microservices!https://bluemix.net