microservices and ibm bluemix meetup presentation
TRANSCRIPT
© 2015 IBM Corporation
Microservices and IBM Bluemix
Tony ErwinBluemix UI ArchitectIBM Cloud [email protected]@tonyErwin
Carlos FerreiraPrinciple Technical Product ManagerIBM Cloud [email protected]@carlosTweets
2#IBMBluemix
Agenda
• The motivation for when to use or not use Microservices• Elements of a Microservice architecture • Why DevOps is critical to the success of Microservices?• Key capabilities required to develop Microservices in Bluemix• Re-architecting the Bluemix UI with a microservices architecture
3#IBMBluemix
What are microservices?
• Is an architecture style, in which large complex software applications are composed of one or more services.
• Can be deployed independently of one another and are loosely coupled
• Small and focused on completing one task• Communication typically done through language-neutral APIs,
typically an Hypertext Transfer Protocol (HTTP)-based resource API using REST
4#IBMBluemix
Comparing monolithic and microservices architectures
5#IBMBluemix
Benefits of microservices for developers
• Enables you to avoid large code base & easier to maintain or add to features
• Use existing skills, or the most optimal language• Improves deployment times and load times for IDE• Makes debugging easier• Enables teams to work more independently of each other• Simplifies tracking code dependencies• Enables complete ownership by a self-contained single team,
from definition through development, deployment, operations, and sunsetting
• Makes it easier to scale bottlenecks
6#IBMBluemix
Benefits of microservices for business
• Agility easier to respond to new customer and market needs • Allows for more frequent delivery and faster delivery times
which means quicker feedback cycles and pivoting• Smaller focused teams that align with business revenue and
cost centers means:• Improved productivity• Better visibility to where resources are allocated• Usage enables movement from low impact business areas to
new or higher impact business areas• Better user experience
• Response times enabled by scaling individual microservice• Availability enabled by resiliency• user experience
• Enables new business models – API Economy
7#IBMBluemix
Example business drivers
See interview with Stefan Piesche CTO to see Constant Contact’s motivation for adopting microservices: https://www.youtube.com/watch?v=oKMGObPMvBw
Moving from monolithic applications to microservices
8
Monolithic app Micro services
Scaling Scaling
9#IBMBluemix
Benefits from microservices for operations
• Fewer reviews and approvals versus monolith applications• Enables service management teams to more easily support
multiple product and service teams• Enables automating deployment, logging, and monitoring
practices across multiple microservice project teams• Easier to identify problems and get support• Applications become more resilient as you adopt a
microservices architectural style
10#IBMBluemix
What to avoid
11#IBMBluemix
Don’t…
• forget about DevOps• manage your own infrastructure• create too many microservices• make services too granular or require too many dependencies
12#IBMBluemix
Agenda
• The motivation for when to use or not use Microservices• Elements of a Microservice architecture • Why DevOps is critical to the success of Microservices?• Key capabilities required to develop Microservices in Bluemix• How Microservices are utilized to design and implement
Bluemix
13#IBMBluemix
Design and test for failure
• Mind-set shift: acceptance of the fact that isolated failures are inevitable
• Design and test to keep the system functioning for as long as possible
• Patterns:• Circuit breaker - Fall back logic ensures failures do not
adversely affect the entire system• Bulkhead – Partitioning to isolate other software and hardware
based system failures
14#IBMBluemix
Circuit Breaker pattern
15#IBMBluemix
Bulkhead pattern
Netflix Application Architecture
EdgeServices
Auth A/B Tests
Member Data
Recommendations
Movie Data Ratings Similar
Movies
Network Boundary
XBOX Web Site Call Centre Android IPhone Wii PS3
Client Code
Client Adapter Code
Server Code
• Decompose application into many calls to microservices
• Device makes only one call to the API to minimise WAN latency
17#IBMBluemix
API Gateway pattern
18#IBMBluemix
Interprocess communication
• Synchronous HTTP-based mechanisms, such as Representational State Transfer (REST) or WebSockets, which enable keeping a communication channel between browser and server for request/response
• Asynchronous messaging using a message broker or event driven
#IBMBluemix
• Focused business capability
• Cross-functional teams
• Communication via API ONLY!!
• Decoupled & asynchronous using messaging / events to remove peer-to-peer dependencies
• REST communication
• Decentralized & isolated data
• Designed and tested for failure
• Evolutionary design with pluggable architecture
• Enabled by continuous delivery & DevOps
Summary of a microservice architecture
20#IBMBluemix
How is this different than service-oriented architecture?
• Are not discovered at run time• Do not require mediation• Business motivation is focused on immediate ROI and not
enterprise business tranformational or driven primarily by reuse
21#IBMBluemix
Agenda
• The motivation for when to use or not use Microservices• Elements of a Microservice architecture • Why DevOps is critical to the success of Microservices?• Key capabilities required to develop Microservices in Bluemix• Re-architecting the Bluemix UI with a microservices architecture
22#IBMBluemix
DevOps
• Is the set of concepts, practices, tools, and team organizational structures that enable organizations to more quickly release new capabilities to their clients. Organizations that adopt DevOps are more easily able to release and monitor their microservices
• Commonly includes the following processes:• Agile practices (http://agilemanifesto.org/principles.html)• Continuous integration• Release automation• Functional unit testing• System integration testing• Service and infrastructure monitoring• API microservice management
23#IBMBluemix
Why DevOps is critical to the success of Microservices?
• Microservices = enable agility which means more apps and more frequent deployments
• Without DevOps automation it become cost prohibitive to broadly adopt microservices
• Automation demands that there be standardization• Platform as service enables standardization
24#IBMBluemix
What DevOps tasks can be automated?
• Provisioning infrastructure and configuration• Application deployment and database changes• Development driven testing including:
• Functional unit tests• System integration tests• User acceptance tests• Performance tests• Security tests• Controlled failure resiliency tests
Service A
Service B
Client Side Routing
Runtime Registry
Metrics
Elastic Auto Scaling
Service B Service B
Fault avoidancePlatform supported testing methodologies
Canary testing, A/B testingIncrementally move traffic to new service deployments
Fault IsolationFine grained decoupled services architectureClient library mediated external calls
e.g. enforced hygiene - separate request thread pool, standard approach for timeouts
Stateless servicesDynamic routing to route around failures
e.g. Circuit breakers
Fault DetectionMonitoring metrics for failures
Client library for external calls provides failure and performance metrics
RecoveryDynamic routing to route around failuresFast roll forward / rollback between versions
Cloud Native applications require new set of capabilities from Cloud PlatformNew “middleware” to enable cloud native applications e.g. Netflix OSS, Twitter FinagleAddress gap between IaaS/PaaS capabilities and platform needed by cloud native applications
Service B1
Elastic Auto Scaling
Service B1 Service B1
Real time metrics from client library on service failure and performance
Analysis of metrics can result in service marked down – circuit breaker
Service registry enables dynamic routing – for load, canary test, circuit breaker
1% traffic - Canary test for new service B implementation. Fast rollback if errors found
Elastic AutoScale groups provide scale out and restart capabilities
Edge Service
Edge Service provides dynamic routing, load shedding, canary test, stress test…
Cloud Native Approaches for Resilience“Embrace Failure”
26#IBMBluemix
Controlled failure resiliency tests
Trigger chaos events during business hours• People are around to a) respond to them and b) fix them. Decide what level of mystery you want• Log faiure test triggered event but not the details of the chaos• Simulates a real outage because in the initial stages you need to triage the
monitoring and alerts to see where the failures are but it means that everyone knows to look out for strange things.
Have several failure modes• Killing process instances is just one way to simulate failure but doesn’t cover all
possible options• Network failure, storage failures and others• Enable failure resiliency tests to be triggered via APIsDon’t trigger sequential events• One chaos event at a time and build it into you your schedulePlay around with the event probability• Events should be infrequent and random and there may be none triggered for
several days. • Helps to test your on-call response to keep the unexpected nature of these
kinds of events real.
27#IBMBluemix
Microservice API management
• Establish a practice for publishing, promoting and overseeing microservice application programming interfaces (APIs) in a secure, scalable environment.
• Capabilities include:• Creation of end user support resources that define and
document the API• Access controls• Plans• Threshold limits• Design guidance• Analytics of usage and availability• Availability across public cloud, private cloud, on-premise, or
multi geographic regions
Good reads!!
28
Automate deployments using production-like environments and accelerate delivery cycles
A view into the cultural challenges of adopting DevOps and best practices Patterns for building resilient
and robust applications with Bluemix
29#IBMBluemix
Agenda
• The motivation for when to use or not use Microservices• Elements of a Microservice architecture • Why DevOps is critical to the success of Microservices?• Key capabilities required to develop Microservices in
Bluemix• Re-architecting the Bluemix UI with a microservices architecture
30
BenefitsMost control in the cloud.Necessary for some solutions.Infrastructure managed by SP.
Infrastructure as a ServiceCustomer Managed
Service Provider Managed
~ Days
Time CommitmentMinutes to provision VM.Time to configure software and apps varies.Maintenance/upgrades of OS, middleware, runtime.
IBM SoftLayer
Timing is critical…
~ Minutes
Code
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
~ Weeks
Core IT
Today’s apps must keep up with the speed of the app revolution.
Time to initial deployment
31
~ Minutes
Platform as a ServiceCustomer Managed
Service Provider Managed
IaaS
BenefitsSetup environments and deploy apps very quickly.Infrastructure and platform managed by SP.
Time CommitmentMinutes to setup and deploy.Focus on your apps and their data.
Timing is critical…
~ Weeks
IBM Bluemix
~ Days
Time to initial deployment
Code
Data
Runtime
Middleware
OS
Virtualization
Servers
Storage
Networking
Core IT
Today’s apps must keep up with the speed of the app revolution.
32#IBMBluemix
Foundational services
• Compute: Cloud Foundry, Containers and Virtual Images • Autoscale groups• Elastic load balancing• Runtime registry, load balancing, dynamic routing• Developer services – IDE, build, image creation & deployment• Canary testing, A/B testing and rolling upgrade• Metrics, monitoring, logging information for all service
invocations• Message queues• Event notifications and triggering actions• Orchestrate and coordinate the REST-based services• API management
*Some services aren’t available on Bluemix
More openness and choice than ever before
33
You choose how you build, deploy, and manage your apps. Bluemix takes care of the rest.
ComputeChoose the level of infrastructure abstraction based on your app’s architectural needs.
Dev ToolingFrom editors to source code management to continuous delivery, you can use Bluemix’ powerful tooling or easily bring your own.
LocationDeploy apps to Bluemix Public (in a growing number of geos), your own dedicated cloud Bluemix, or one that runs within your data center (Local*).
ServicesPick from a catalog of IBM, third party, open source, or your own services to extend your apps.
IBM
Third Party
Open Source
Yours
34#IBMBluemix
Bluemix Compute
#IBMBluemix
Docker Containers— separation of concerns
Dan the DeveloperWorries about what’s “inside” the container• His code• His Libraries• His Package
Manager• His Apps• His Data
All Linux servers look the same
Oscar the Ops GuyWorries about what’s “outside” the container• Logging• Remote access• Monitoring• Network config
All containers start, stop, copy, attach, migrate, etc. the same way
36#IBMBluemix
VMs vs Containers
AppA
Hypervisor (Type 2)
Host OS
Server
GuestOS
Bins/Libs
AppA’
GuestOS
Bins/Libs
AppB
GuestOS
Bins/Libs
VM
GuestOS
GuestOS A
pp A’
Host OS
Server
Bins/Libs
App A
Bins/Libs
App B
App B
’
App B
’
App B
’Container
Containers are isolated,but share OS and, whereappropriate, bins/libraries
…faster, less overhead
#IBMBluemix
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1Appv1
Original
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1Appv1
Trial Ramp-down
Servicev1
Servicev1
Servicev1AppV2
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1Appv1
Ramp-up
The successor receives production traffic. It starts with low traffic and is ramped up during testing phase.
The original is disabled but available for instant roll-back.
The original group is scaled down and the successor continues as the new version.
Rolling deployments
1. 2.
4.3.
Instance Groups
Active Group – routing enabled
In-Active Group – routing disabled
Appv2
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1Appv2
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1
Servicev1Appv2
Servicev1
Servicev1
Servicev1Appv1
Up
Down
RoutedTraffic
#IBMBluemix
Quick update propagationInformed resolutionFlexible resolution methods
Service Discovery – Bluemix Catalog
39
IBM Enterprise Containers on Bluemix
Automate the build of Docker images
Manage and distribute Docker images in private image registries
Easily host containers in the cloud
Scale and auto-recovery built-in
Logging and Monitoring built-in
Application Scaling & High Availability
Monitor your apps in real time
41
Integrated diagnostics for detailed application behavior.
42
Logging
IBM Bluemix DevOps Services – Delivery Pipeline
• Integration test, System test, Production
• Automation ensures the same procedure in each environment
• Fully hosted, managed, and integrated in the cloud for the cloud
• Deploy to Bluemix Button
#IBMBluemix
Delivery Pipeline for Containers on Bluemix
IBM ContainerImage Build
Service
Image Registry
45#IBMBluemix
IBM Workload Scheduler
46#IBMBluemix
IBM API Management
47#IBMBluemix
Agenda
• The motivation for when to use or not use Microservices• Elements of a Microservice architecture • Why DevOps is critical to the success of Microservices?• Key capabilities required to develop Microservices in Bluemix• Re-architecting the Bluemix UI with a microservices
architecture
48#IBMBluemix
IBM Bluemix
• IBM Bluemix:• Open-standards, cloud platform for building, running,
and managing apps• PaaS layer built on CloudFoundry
• Bluemix UI is the front-end, providing an alternative to the CF command line
49#IBMBluemix
Bluemix UI on Bluemix: Nexus of the Universe?
Jerry: “What street are you on?”Kramer: “I'm on First and First. How can the same street intersect with itself? I must be at the Nexus of the Universe!”
50#IBMBluemix
Bluemix UI – Major Sections
Home
Solutions (Marketing)
Pricing
Dashboard
Catalog
Orgs/Spaces
51#IBMBluemix
Bluemix UI – Originally a Monolith
• Single-page application (SPA) to provide desktop-like experience in the browser
• All HTML, CSS, and JavaScript loaded within single web page and served from a single Java app
• State-of-the-art not all that long ago• Dojo + J2EE was the most common stack in IBM
when Bluemix UI dev started• SPA still popular (AngularJS, Ember.js etc.)
52#IBMBluemix
Monolithic Architecture
Home Solutions Catalog Dashboard Pricing Orgs/ Spaces
CF Cloud Controller (and other APIs)
DB/2Bluemix UI Server
(Java)
Bluemix UI (Client)
Bluemix PaaS
53#IBMBluemix
Challenges of Monolith
• How can we improve performance?• Volume of client-side requests create bottlenecks
• How do we integrate code from other teams using different stacks?
• How can we push smaller changes as they are ready?• Where do we find developers with Dojo experience?• How can we improve SEO?
54#IBMBluemix
Promises of Microservices• Aids migration to more modern, lighter-weight stack without starting over• Improves performance and developer productivity
• Small services optimized for speed and page size– Use simplest approach that works– Bare bones HTML, CSS, JS– Node.js w/ Dust.js server-side templates
• Easier to find answers on Google, easier to find skilled developers• Allows more regular updates as loosely-coupled services can deploy at their
own schedule• Teams use stack of their choosing• Teams don’t have to wait on others
• Leads to improved SEO• Proxy facilitates “clean” URLs• Server side generation results in crawlable content
• Improves cross-team UI consistency via microservice composition
55#IBMBluemix
Migration Phase 1
Solutions
Catalog Dashboard Pricing Orgs/ Spaces
CF Cloud Controller (and other APIs)
DB/2Bluemix UI
Server (Monolith)
Bluemix UI (Client)
Bluemix PaaS
Proxy
Common
IBM Data Cache
Cloudant NoSQL DB
Monitoring Framework
Home
56#IBMBluemix
Composition w/ Microservices
header
footer
inline
combined
Common
Home
57#IBMBluemix
Migration End Goal
Home Solutions Catalog DashboardPricing Orgs/ Spaces
CF Cloud Controller (and other APIs)
Bluemix UI (Client)
Bluemix PaaSProxy
Common
IBM Data Cache
Cloudant NoSQL DB
Monitoring Framework
58#IBMBluemix
New Challenges
• More moving parts, more complexity• Collecting federated status, monitoring health of the
system• Seamless navigation with existing monolith• Developer skills (need to learn new stack, but will
ultimately be more productive)• Blue-green deployments
59#IBMBluemix
Approach for Blue-Green –Change Route on Proxy
Homehome-XXX.bluemix.net
Solutionssolutions-XXX.bluemix.net
Bluemix UI Server classic-XXX.bluemix.net
Proxy
Commoncommon-XXX.bluemix.net
HomeHome-YYY.bluemix.net
Solutionssolutions-YYY.bluemix.net
Bluemix UI Server classic-YYY.bluemix.net
Proxy
Commoncommon-YYY.bluemix.net
Go Router
console.ng.bluemix.net console-YYY.ng.bluemix.net
© 2015 IBM Corporation
Thank you!
Questions?