WEBINAR Modernizing Applications with Microservices and DC/OS Markus Eisele (@myfear), Lightbend Aaron Williams (@_arw_), Mesosphere
WEBINAR
Modernizing Applications with Microservices and DC/OS
Markus Eisele (@myfear), Lightbend Aaron Williams (@_arw_), Mesosphere
LL: Building and Scaling Monoliths• Monolithic application – everything is
package into a single .ear• Reuse primarily by sharing .jars• A “big” push to production once or twice a
year• Single database schema for the entire
application• >= 500k loc• >= Heavyweight Infrastructure• Thousands of Testcases • Barely New Testcases
• >= 20 Team Member• The single .ear requiring a multi-month
test cycle /• Huge bug and feature databases• User Acceptance Undefined• Technical Design Approach• Barely Business Components or Domains• Requiring multiple team involvement &
significant oversight• Technical Dept• Outdated Runtimes (Licenses, Complex
updates)• Grown applications
More users
http
://w
ww
.inte
rnet
lives
tats
.com
/inte
rnet
-use
rs/
J2EE
Spring
RoR
Akka
Reactive Manifesto
Microservices
New requirements• Rather than acting on data at rest, modern
software increasingly operates on data in near real-time.
• Shortened time-frames for putting changes into production
• New business models evolve from existing ones
• New questions need to be answered by existing applications
• Datacenter costs need to go down constantly
Routing Module
Tracking Module
Order Module
Tracker UIBrowser HistoryDB
Order DB
RoutesDB
Tracker UI
Tracker UI
Browser
Browser
REQ: Building and Scaling Microservices
• Lightweight runtime• Cross – Service Security• Transaction Management• Service Scaling• Load Balancing• SLA’s• Flexible Deployment• Configuration• Service Discovery• Service Versions
• Monitoring• Governance• Asynchronous communication• Non-blocking I/O• Streaming Data• Polyglot Services• Modularity (Service definition)• High performance persistence (CQRS)• Event handling / messaging (ES)• Eventual consistency• API Management• Health check and recovery
“Microservices” is a lousy term• Size is irrelevant
We want flexible systems and organizations that can adapt to their complex environments, make changes without rigid dependencies and coordination, can learn, experiment, and exhibit emergent behavior.
Software DesignOuter Architecture
Methodology and Organization
Distributed Systems
Datacenter Operating System
Software Design
Architecture Principles
• Single Responsible Principle• Service Oriented Architecture
– Encapsulation– Separation of Concern– Loose Coupling
• Hexagonal Architecture
Design Patterns
• Domain-driven Design• Bounded Contexts• Event Sourcing• CQRS• Eventual Consistency• Context Maps
Design Best Practices
• Design for Automation• Designed for failure• Service load balancing and automatic scaling• Design for Data Separation• Design for Integrity• Design for Performance
Strategies For Decomposing
Verb or Use Casee.g. Checkout UI
Noune.g. Catalog product service
Single Responsible Principle e.g. Unix utilities
• Reactive Microservices Framework for the JVM• Focused on right sized services• Asynchronous I/O and communication as first class
priorities• Highly productive development environment• Takes you all the way to production
What is Lagom?
• Event sourced (deltas) with Cassandra backend by default
• No object/relational impedance mismatch• Can always replay to determine current state• Allows you to learn more from your data later• Persistent entity is an Aggregate Root in DDD• Can be overridden for CRUD if you want
Lagom Persistence API
>sbt bundle:dist...[info] Your package is ready in /Users/myfear/lagom-cargotracker/front-end/target/universal/front-end-1.0-SNAPSHOT.zip
Create Service bundles
© 2015 Mesosphere, Inc. All Rights Reserved. 28
Datacenter Operating System (DC/OS)
ENTERPRISEMICROSERVICES
© 2015 Mesosphere, Inc. All Rights Reserved.
TOWARDS MICROSERVICES ARCHITECTURE
Traditional Architecture Microservices Architecture
Small number of large processes with strong inter-dependencies
Cross-functional teams creating new microservices without interdependencies
REST
API
s
Scales monolithically
Many functions in a single process
Cross-functional teams organized around capabilities
Scales individually
Siloed teams
Each element of functionality defined as “microservices”
© 2015 Mesosphere, Inc. All Rights Reserved. 30
THE DATACENTER IS THE NEW SERVER
PHYSICAL (x86) VIRTUAL HYPERSCALEMAINFRAME
SERVER VIRTUAL MACHINEPARTITION (LPAR)UNIT OF INTERACTION
● ERP, CRM, PRODUCTIVITY, MAIL & WEB SERVER
● LINUX, WINDOWS
● DATA / TRANSACTION PROCESSING
● UNIX, IBM OS/360
DEFINITIVE APPS AND OS
● ERP, CRM, PRODUCTIVITY, MAIL & WEB SERVER
● HYPERVISOR + GUEST OS
● BIG DATA, INTERNET OF THINGS, MOBILE APPS
● ???
???DATACENTER
NEW FORM FACTOR FOR DEVELOPING AND RUNNING APPS
● BIG DATA, INTERNET OF THINGS, MOBILE APPS
● DATACENTER OPERATING SYSTEM (DCOS)
© 2015 Mesosphere, Inc. All Rights Reserved.
Datacenter Operating System (DCOS)
Distributed Systems Kernel (Apache Mesos)
DC/OS ACCELERATES ENTERPRISES TO A MODERN CLOUD STACK WITH THE DATACENTER FORM FACTOR
Big Data + Analytics EnginesMicroservices (in containers)
Streaming
Batch
Machine Learning
Analytics
Functions & Logic
Search
Time Series
SQL / NoSQL
Databases
Modern Cloud App Components
Distributed systems kernel to abstract resources
Killer “apps” ecosystem
Cont Integration/Cont Delivery
Framework “app” architecture to consistently run on top of kernel
User Interface (GUI & CLI)
Core system services (e.g., distributed init, cron, service discovery, package mgt & installer, storage)
Any Infrastructure (Physical, Virtual, Cloud)
DC/OS FEATURE
PRODUCTION PROVEN TECHNOLOGY AT SCALEDC/OS ARCHITECTURE
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
● DC/OS is built on the production-proven Apache Mesos and Marathon
● Built and refined with best practices by some of the world's top experts in distributed systems
● Tested to 10s of thousands of nodes in production for more than 6+ years in production
● Designed for resiliency and scale from day 1
● Reliable, mature technology with years of bug fixing, reduce risk of downtime for mission critical workloads
● Easily expand from small to very large clusters with confidence
● Open source core prevents vendor lock-in
DC/OS FEATURE
MODERN DISTRIBUTED HIGH AVAILABILITYDC/OS ARCHITECTURE
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
● No SPOF, N+1 Architecture
● Integrated KV Store, DB & load balancing for seamless failover and maintenance
● Turn-key solution, no external dependencies for HA
● Agent crash, restart & upgrade does not affect workloads
● Erlang based distributed networking stack for on the fly upgrade
● Non disruptive failover and upgrade for masters and agents
● Highest uptime for scalable masters, agents and workloads
● No manual intervention in case of master/agent failover
● Easily move to the latest DC/OS release
● Resilience to network partitioning & split brain scenarios
DC/OS FEATURE
CONTAINERS AND DATA SERVICESWORKLOAD SUPPORT ON DC/OS
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
Supports Stateless and Stateful Containers● Docker Containers
● Mesos Containers (i.e Java Binaries, Go Binaries)
Supports Stateful Data and Analytics Services● Analytics & Big Data (i.e Spark, HDFS), No-SQL Databases (i.e Cassandra)
● Search (i.e Elasticsearch), Message Queueing (i.e Kafka)
Linux and (soon) Windows
● Increased Utilization across datacenter
● Easily scale applications up and down
● Single platform for all applications, simplifying operations
● Easily experiment & deploy with new datacenter services easily with our app Universe
DC/OS FEATURE
SERVICE DISCOVERYDC/OS Networking
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
DC/OS Master
DC/OS Svc. Registry (DNS)DC/OS Master
DC/OS Svc. Registry (DNS)DC/OS Master
DC/OS Svc. Registry (DNS)
Corporate/External DNS Server
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
rService 1
Service 2
Service 3
External Service
● DNS-based Service Registry & Distr. DNS Proxy
● Integrated DC/OS Service Discovery
● Integrated External Service Discovery
● Highly available & scalable service registry
● Turn-key solution to deploy micro-services
● Integration with existing non-DC/OS services to enable brownfield deployments.
DC/OS FEATURE
SERVICE AVAILABILITY WITH L4 DISTRIBUTED LBDC/OS Networking
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
rService 1
Service 2
Service 3
Service 2Virtual IP
Virtual IP
Service 1 Service 3
Virtual IP
● Fast Converging Distributed Load Balancer
● Integrated with DC/OS Service Discovery
● Integrated Blue-Green deployment
● Support for variety of Layer 4 LB algorithms
● Highly available LB with no single choke point
● Enable non-disruptive service upgrades with blue-green deployments.
● Highly scalable and tolerant to large # of host failures.
DC/OS FEATURE
STATEFUL CONTAINERS WITH VOLUMESDC/OS Storage
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
r
DC/OS Agent
Cont
aine
r
Cont
aine
r
Cont
aine
rService 1
Service 2
Service 3
Virtual IP
Virtual IP
Virtual IP
● Persistent Local Volumes for Containers
● External Volumes using Shared Storage
● DC/OS Volume Management UI
● Run Stateful applications like MySQL in Containers.
● Integrate with existing shared storage
● Manage & Troubleshoot with integrated volume manager
DC/OS FEATURE
MODERN GRAPHICAL USER INTERFACEDC/OS POWERFUL MANAGEMENT TOOLS
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
Simple UI to deploy and manage ● Containers
● Jobs, scheduled and recurring (formerly Chronos)
● Datacenter services with App universe
● Infrastructure Mgmt, Security and Access Control
● Monitoring & Troubleshooting
● Simplified application portability, cloud bursting, ensuring no vendor lock-in (true hybrid cloud).
● Simplified CI/CD integration, No complex scripts to manage/maintain across environments
DC/OS FEATURE
POWERFUL COMMAND LINE INTERFACE (CLI)DC/OS POWERFUL MANAGEMENT TOOLS
BENEFITS
© 2016 Mesosphere, Inc. Proprietary & Confidential
● Powerful CLI for deploying and managing all workloads including containers, jobs & packages
● Monitor & troubleshoot application and system logs
● Run on Mac, Windows, Linux
● Native ssh encryption
● Integrated access control
● Securely manage your datacenter, anywhere
● Build powerful scripts from administrator machine
● Automate datacenter administration using powerful change managements tool (chef/puppet)
Next Steps! Download and try Lagom!Project Site:http://www.lightbend.com/lagom
GitHub Repo:https://github.com/lagom
Documentation:http://www.lagomframework.com/documentation/1.0.x/Home.html
Example:https://github.com/typesafehub/activator-lagom-java
Written for architects and developers that must quickly gain a fundamental understanding of microservice-based architectures, this free O’Reilly report explores the journey from SOA to microservices, discusses approaches to dismantling your monolith, and reviews the key tenets of a Reactive microservice:
• Isolate all the Things• Act Autonomously• Do One Thing, and Do It Well• Own Your State, Exclusively• Embrace Asynchronous Message-Passing• Stay Mobile, but Addressable• Collaborate as Systems to Solve Problems
http://bit.ly/ReactiveMicroservice
The detailed example in this report is based on Lagom, a new framework that helps you follow the requirements for building distributed, reactive systems.
• Get an overview of the Reactive Programming model and basic requirements for developing reactive microservices
• Learn how to create base services, expose endpoints, and then connect them with a simple, web-based user interface
• Understand how to deal with persistence, state, and clients
• Use integration technologies to start a successful migration away from legacy systems
http://bit.ly/DevelopReactiveMicroservice