microservices: architecture and practice

26
MICROSERVICES www.iron.io Architecture and Practice

Upload: ironio

Post on 15-Apr-2017

383 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Microservices:  Architecture and Practice

MICROSERVICES

www.iron.io

Architecture and Practice

Page 2: Microservices:  Architecture and Practice

About Iron.io

Infrastructure

Runtime Apps Async Workloads

APIs

>50% of the modern workload processing happens in the background asynchronously.

IronMQ IronScheduler

IronWorker

Page 3: Microservices:  Architecture and Practice

Microservices

Page 4: Microservices:  Architecture and Practice

Microservices Search Trend

Page 5: Microservices:  Architecture and Practice

A service-oriented architecture composed of loosely coupled elements that have bounded contexts.

Microservices

Every service can be updated independently and without risk

Model where you don’t need to know internals of peer services.

Adrian Cockcroft, Battery Ventures (previously lead cloud architect for Netflix)

Page 6: Microservices:  Architecture and Practice

Monolith vs MicroservicesAll functions, single process Single function per process

scale by replicating monolith across nodes scale by distributing services across nodes

Page 7: Microservices:  Architecture and Practice

Considerations➔ Building and maintaining highly available

distributed systems is complex

➔ More moving parts means more components to keep track of and configure properly

➔ Loosely coupled services means steps must be taken to keep data consistent

➔ Distributed asynchronous processes create network latency and more API traffic

➔ Testing and monitoring individual services is challenging

Page 8: Microservices:  Architecture and Practice

What We’ve Learned at Iron.io

Page 9: Microservices:  Architecture and Practice

Empowering Developers

⬢ Innovation depends on developers

⬢ Developers want abstraction

⬢ Developers want self-service⬢ Developers want tools to get out

of the way

⬢ Developers want to write code!

Page 10: Microservices:  Architecture and Practice

Code API

URL HTTP Verb Purpose

/projects/{Project ID}/codes GET List Code Packages

/projects/{Project ID}/codes POST Upload or Update a Code Package

/projects/{Project ID}/codes/{Code ID} GET Get Info About a Code Package

/projects/{Project ID}/codes/{Code ID} DELETE Delete a Code Package

/projects/{Project ID}/codes/{Code ID}/download GET Download a Code Package

/projects/{Project ID}/codes/{Code ID}/revisions GET List Code Package Revisions

IronWorker makes it easy to write, package, and upload code to our system

Page 11: Microservices:  Architecture and Practice

Task API

URL HTTP Verb Purpose

/projects/{Project ID}/tasks GET List Tasks

/projects/{Project ID}/tasks POST Queue a Task

/projects/{Project ID}/tasks/webhook POST Queue a Task From a Webhook

/projects/{Project ID}/tasks/{Task ID} GET Get Info About a Task

/projects/{Project ID}/tasks/{Task ID}/log GET Get a Task's Log

/projects/{Project ID}/tasks/{Task ID}/cancel POST Cancel a Task

/projects/{Project ID}/tasks/{Task ID}/progress POST Set a Task's Progress

/projects/{Project ID}/tasks/{Task ID}/retry POST Retry a Task

Page 12: Microservices:  Architecture and Practice

● Before: Monolithic PHP app● After: Services - Social, Geo, Image, Recommendation

Result: 500K check-ins/night, 500ms response, 1 engineer

Case Study

Page 13: Microservices:  Architecture and Practice

Small Loosely Coupled Teams

Page 14: Microservices:  Architecture and Practice

Stateless by Design

You name them and when they get sick you nurse them back to health.

You number them and when they get sick, you shoot them.

Page 15: Microservices:  Architecture and Practice

Stateless by Design

Page 16: Microservices:  Architecture and Practice

Stateless using Webhooks

● Job can be kicked off using a webhook URL and HTTP Post

● Create powerful workflow between workers, services, and other endpoints

Page 17: Microservices:  Architecture and Practice

Case Study

● Before: A single process that handles the entire ETL pipeline

● After: A set of stateless services that only understand their single purpose functions. Each scale independently.

Result: Dozens of sources syncing 24x7 with NO infrastructure

Cloud ETL

Page 18: Microservices:  Architecture and Practice

Queue all the Things

➔ Decouples➔ Buffers➔ Delivery/Order properties➔ Async Communication

Page 19: Microservices:  Architecture and Practice

Services: Collection, Process, Send● Intelligent speed bumps that activate only when

needed● Road modules collect speed, vehicle type, and other

data ● Ops gains intelligence for traffic management and flow

Result: Faster and simpler data collection and processing

Case StudyIoT Data Collection and Processing

Page 20: Microservices:  Architecture and Practice

Containerize Everything

⬢Can be any but Docker is winning

⬢Stateless and horizontal scaling

⬢Deploy anywhere

⬢Enables full developer workflow and

CI/CD

Page 21: Microservices:  Architecture and Practice

Monitor, Alert, Analyze

Runtime Monitoring

Audit trails

Logging

Error Handling

Alerting

Performance Testing

Page 22: Microservices:  Architecture and Practice

Worker/Service List

Page 23: Microservices:  Architecture and Practice

Tracking Activity

Page 24: Microservices:  Architecture and Practice

Polyglot Persistence

Key/ValueRapid access for reads/writes

SQLTransactional data

NoSQLHigh volume reads

FileDistributed file system

Page 25: Microservices:  Architecture and Practice

Share Nothing, Denormalize

Service A Service B

MDM

Page 26: Microservices:  Architecture and Practice

Iron.io325 9th StSan Francisco, CA 94103

1-888-939-4623www.iron.io

[email protected]

THANK YOU

QUESTIONS?