Vous êtes sur la page 1sur 36

FRONTLINE SYSTEMS

Microservice Architecture

Vikash Kodati

AGENDA

Microservice: What it IS and NOT


Motivation
Characteristics of Microservice
Monolith vs Microservice
Activities @ T-Mobile
Q&A

4/6/2016

T-Mobile Confidential

WHAT IS A MICROSERVICE?
Microservice is an architecture style in which a large application is built as a suite of modular
services. Each service supports a specific business function. Each service is developed, tested,
deployed, updated/replaced and scaled independently without impacting the entire application

Common
Characteristics

6/13/2016

Organize
around
product not
project
Componenti
ze,
containerize
developed
& deployed
independen
tly

Organize
around
business
capability

Microser
vice

Fault
Tolerance,
Smart End
Point,
Cloud Ready

T-Mobile Confidential

Have it own
data
storage/db
and runs on
its own
process
Highly
decoupled
and focused
on doing a
single task

WHAT A MICROSERVICE IS NOT


A simple API to a more complex service implemented as
part of a monolithic application.
A service implemented with a small amount of code.
A service implemented with share database
A service exposed via API by external service provider (if TMobile doesnt have control of the implementation, its just
a service)
A component, service or capability, labeled as a
"microservice" by a vendor

4/6/2016

T-Mobile Confidential

MOTIVATION

Whats our Motivation?

6/13/2016

T-Mobile Confidential

OUR MONOLITHs
Its easy to start building applications that become Monolithic

Diverse business functions/capabilities/modules under one umbrella


Entire Dev team deals with all parts of the application
Diverse external libraries in one Classpath, Cross cutting concerns
Every release and deployment process resulting in ONE logical executable
Tightly coupled integrations (PL/SQL inserts, synchronous handshakes etc)
More data, more users leads to SCALING OUT the application
Super Cool Application

UI
Component

6/13/2016

Business
Logic

T-Mobile Confidential

Persistency
Layer

MONOLITHs CONTINUED

Super Cool Instance


Super Cool Instance
Super Cool Instance
Super Cool Instance

6/13/2016

Super Cool Instance


Super Cool Instance
Super Cool Instance
Super Cool Instance

T-Mobile Confidential

FRONTLINE SYSTEMS - MISSION

Enable T-Mobiles Frontline teams to


consistently interact with our customers
throughout the selling and serving lifecycle,
delivering an exemplary and intuitive
experience enabled by operational excellence
and innovation

6/13/2016

T-Mobile Confidential

MOTIVATION DEFINED

BRIDGE the gap


Applications have to be decomposed into
microservices for improving deployability and
scalability and simplifying adoption of new
technologies

6/13/2016

T-Mobile Confidential

WHAT IS MICROSERVICE?

Microservice is an architecture style in which a


large application is built as a suite of modular
services. Each service supports a specific
business function. Each service is developed,
tested, deployed, updated/replaced and scaled
independently without impacting the entire
application
10

6/13/2016

T-Mobile Confidential

CHARACTERISTICS OF MICROSERVICES

Componentization via services


Organized around business capabilities
Products not projects
Smart endpoints and dump pipes
Decentralized Data Management
Infrastructure Automation
Design for failure

11

6/13/2016

T-Mobile Confidential

COMPONENTIZATION VIA SERVICES

Break software into components


Components should be independently

Replaceable
Upgradeable

Model the SERVICE as a Component

12

Self sufficiently running in its own process


Interacting with other services via web service requests

6/13/2016

T-Mobile Confidential

ORGANIZED AROUND BUSINESS CAPABILITIES


Any organization that designs a system (defined broadly) will produce a design whose
structure is a copy of the organization's communication structure.
-- Melvyn Conway, 1967

13

6/13/2016

T-Mobile Confidential

CONTINUED

Make teams will be cross-functional


Team responsible for development,
operations, communications &
business value
Services take up a broad-stack (UI,
Storage and 3rd party collaborations)
Well defined boundaries

14

6/13/2016

T-Mobile Confidential

SCALE CUBE

15

6/13/2016

T-Mobile Confidential

SMART ENDPOINTS AND DUMB PIPES


End points should contain
Business logic, routing rules
Have a robust and efficient pipping mechanism (plumbing)
Connect everything together
Direct RESTful calls
Lightweight message bus (Kafka or RabbitMQ)
Analogous to Unix filters : receiving a request, applying logic and
produce a response

16

6/13/2016

T-Mobile Confidential

SMART ENDPOINTS AND DUMB PIPES

17

6/13/2016

T-Mobile Confidential

SMART ENDPOINTS AND DUMB PIPES

18

6/13/2016

T-Mobile Confidential

DECENTRALIZED DATA MANAGEMENT

19

6/13/2016

T-Mobile Confidential

X Y Z AXES DEFINED

20

6/13/2016

T-Mobile Confidential

INFRASTRUCTURE AUTOMATION

Server provisioning
Configuration management
Automated builds
Automated testing
Automated deployments
Monitoring

Goal: Infrastructure As Code


Provision and Tear-down universes (server farms) at the
click of a button/command
21

6/13/2016

T-Mobile Confidential

CLOUD MODELS

22

6/13/2016

T-Mobile Confidential

CLOUD MODELS

23

6/13/2016

T-Mobile Confidential

DESIGN FOR FAILURE


Typical first year for a new cluster:
~0.5 overheating (power down most machines in <5 mins, ~1-2 days to recover)
~1 PDU failure (~500-1000 machines suddenly disappear, ~6 hours to come back)
~1 rack-move (plenty of warning, ~500-1000 machines powered down, ~6 hours)
~1 network rewiring (rolling ~5% of machines down over 2-day span)
~20 rack failures (40-80 machines instantly disappear, 1-6 hours to get back)
~5 racks go wonky (40-80 machines see 50% packet loss)
~8 network maintenances (4 might cause ~30-minute random connectivity losses)
~12 router reloads (takes out DNS and external vips for a couple minutes)
~3 router failures (have to immediately pull traffic for an hour)
~dozens of minor 30-second blips for dns
~1000 individual machine failures
~thousands of hard drive failures
slow disks, bad memory, misconfigured machines, flaky machines, etc.
Note: Data taken from Jeff Deans slides
24

6/13/2016

T-Mobile Confidential

CAP Theorem
It is impossible for a distributed system to simultaneously provide all 3
guarantees
1. Consistency: All nodes see the same data at a given time
2. Availability: Every request receives a response
3. Partition Tolerance: Tolerant to failure of a part of the system

25

6/13/2016

T-Mobile Confidential

Not P => CA
MySQL

P => C XOR A
CP System
AP System

NOSQL Landscape

26

6/13/2016

T-Mobile Confidential

DATA MODELS
Relational
RDBMS like MySQL

Key-Value
Support put, get, delete based on a primary key

Column-Oriented
Tables are still used and Joins are handled at the client
Store data by column as opposed to traditional row-oriented databases

Document-Oriented
Stores structured documents like XML, JSON
No Joins

27

6/13/2016

T-Mobile Confidential

MONOLITHIC vs. MICROSERVICE


Monolithic Architecture

Microservice Architecture

Simple: Built as a single, autonomous


unit of app

Partial Deployment: Each element of


functionality is a separate service

Consistency: Tightly coupled. One


database for the entire app.

Highly decoupled. Each service has its


own database. Eventual consistency

A modification made to a small section


of an app might require building,
testing and deploying an entirely new
version

Preserve Modularity: Each service can be


developed/changed/replaced, tested and
deployed individually

The entire app run in one process.


Scale by replicating the entire app

Each service run on it own


process/instance (JVM). Scale by
replicating each service

ACID (Atomicity, Consistency, Isolation,


Durability)

BASE (Basically Available, Soft State,


Eventually Consistent)

Super Computer: Adding resources to a


Distributed System: Adding more nodes
28
6/13/2016
T-Mobile Confidential
single node

APPLICATION STACK COMPARISON


Typical Monolith Application

Distributed Miscroservice Application


Application

Application
Application Framework
RDBMS

COMPUTATIONAL
Framework

NoSQL Stores
Distributed File
System
Multiple Machines
(Cluster)

File System
Single/Multiple
Machines

29

29
6/13/2016

T-Mobile Confidential

T-MOBILE FRAMEWORK

Core

Web App
microapps microapps microapps

Native App
microapps microapps microapps

Any App

iOS

microapps microapps microapps

API Management
Business Services

PaaS

highly reusable microservices

Enterprise Middleware

Logging Adaptor

the transport Layer hide all backend complexity from the business services & frontline apps

Backend Systems

FRAMEWORK: Spring Spring BOOT Spring Cloud Netflix


30

6/13/2016

T-Mobile Confidential

Cloud DB

OTHER RESOURCES and REFERENCES


Microservices, Martin Fowler, James Lewis

http://martinfowler.com/articles/microservices.html

A day in the life of a Netflix Engineer using 37% of the internet

http://fr.slideshare.net/AmazonWebServices/dvo203-the-life-of-a-netflixengineer-using-37-of-the-internet

Dzone Geting started with Microservices

https://dzone.com/refcardz/getting-started-with-microservices

SoundCloud How we ended up with microservices

http://philcalcado.com/2015/09/08/how_we_ended_up_with_microservice
s.html

gRPC - boilerplate to high-performance scalable APIs

31

http://
fr.slideshare.net/AboutYouGmbH/robert-kubis-grpc-boilerplate-to-highper
formance-scalable-apis-codetalks-2015
Twelve-Factor methodology: http://12factor.net/
6/13/2016

T-Mobile Confidential

FUTURE TOPICS?
Docker
Python and Jupyter notebook
Light weight message buses & Dataframes
(e.g., Kafka)
Machine Leaning
Circuit Breaker (e.g., Hystrix)
Mobile Architecture
Solr/Lucene
Case Studies? Use Cases?
Others?
32

6/13/2016

T-Mobile Confidential

THANK YOU & QA


Vikash Kodati

Email: Vikash.Kodati@t-mobile.com
Yammer: https
://www.yammer.com/t-mobile.com/users/vikashkodati
Github: https://github.com/vikashkodati
LinkedIn: /in/vikashkodati
Twitter: @vikashkodati
Blog: https://

tmobileusa.sharepoint.com/portals/hub/personal/vikashkodati
33

6/13/2016

T-Mobile Confidential

MICROSERVICE - DECISION TREE


microservices

NO
YES

high rate of change


limited functionality

monoliths

low rate of change


large code base
lots of different
functionality

T-Mobile Confidential

34

MICROSERVICE is not the answer for all service


Please
ask
yourself

I think
so !

are you
100% sure
you need
microservice
s?

If I have to change any thing


in this monolith app I will kill
my self

You dont need


microservice !

35

4/6/2016

You need
microservice !

T-Mobile Confidential

MICROSERVICE - Things to Consider


WELCOME BACK TO
SOA GOVERNANCE !

Establish and administering governance policies


Ensuring policy compliance during the design, creation, and deploy of
services
Change management
Ensuring quality of services
QoS and Service Level Agreement (SLA) policies that will ultimately
determine the required service levels

Management & Enforcement of services


Define and enforce security on
service consumer
Define and enforce service policies
Service level Agreement
Management
Manage definition, design,
implementation, validation, and
deployment of service

Provide visibility for control & manage services


Real-time monitoring services, end
points, and supporting infrastructure
Manage service, end point, and operation
dependencies.
Exception management
Monitoring, auditing, reporting
End to end traceability, and performance
management

API Gateway

Client-side
discovery

Server-side
discovery

Service Registry

Single
service instances
per container

Database per
Service

Share Database

Database Trigger

36

6/13/2016

T-Mobile Confidential

Provide governance capabilities


Promotion of services through
phases of service lifecycle
Control access to service
information
Impact analysis and
communication (notification) of
changes to services

Self Registration

Multiple service
instances per host

Single
service instances
per host

Event-driven
architecture

Event sourcing

Application Events