Microservices: Architecture and Practice

Post on 15-Apr-2017

378 views 1 download

transcript

MICROSERVICES

www.iron.io

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

Microservices

Microservices Search Trend

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)

Monolith vs MicroservicesAll functions, single process Single function per process

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

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

What We’ve Learned at Iron.io

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!

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

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

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

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

Case Study

Small Loosely Coupled Teams

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.

Stateless by Design

Stateless using Webhooks

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

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

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

Queue all the Things

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

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

Containerize Everything

⬢Can be any but Docker is winning

⬢Stateless and horizontal scaling

⬢Deploy anywhere

⬢Enables full developer workflow and

CI/CD

Monitor, Alert, Analyze

Runtime Monitoring

Audit trails

Logging

Error Handling

Alerting

Performance Testing

Worker/Service List

Tracking Activity

Polyglot Persistence

Key/ValueRapid access for reads/writes

SQLTransactional data

NoSQLHigh volume reads

FileDistributed file system

Share Nothing, Denormalize

Service A Service B

MDM

Iron.io325 9th StSan Francisco, CA 94103

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

sales@iron.io

THANK YOU

QUESTIONS?