+ All Categories
Home > Software > OCTOPARTS by M3, Inc.

OCTOPARTS by M3, Inc.

Date post: 02-Jul-2015
Category:
Upload: scalaconfjp
View: 386 times
Download: 0 times
Share this document with a friend
Description:
http://scalamatsuri.org/
17
Chris Birchall (@cbirchall ) M3, Inc ScalaMatsuri 2014
Transcript
Page 1: OCTOPARTS by M3, Inc.

Chris Birchall (@cbirchall)M3, Inc

ScalaMatsuri 2014

Page 2: OCTOPARTS by M3, Inc.

m3.com

● Portal site for medical professionals○ Medical news, pharmaceutical info, forums, Q&A

site, jobs, shopping, blogging, …○ PC site, smartphone site, a few native apps

● Service-oriented architecture○ Dozens of frontends and backends○ Mostly in data center, a few in the cloud

Page 3: OCTOPARTS by M3, Inc.

Problems● Fault tolerance

○ 1 backend goes down → takes down 5 backends and 10 frontends with it

● Visibility○ debugging and recovering when things go wrong○ measuring performance of backend APIs

● Performance○ lots of serial API calls○ timeouts too long/non-existent○ caching of API responses inconsistent across clients

Page 4: OCTOPARTS by M3, Inc.

Solution!

Page 5: OCTOPARTS by M3, Inc.

Octo-what?Octoparts is an API aggregation middleware

Web

FrontendA

FrontendB

FrontendC

BackendW

BackendX

BackendY

BackendZ

Page 6: OCTOPARTS by M3, Inc.

Features

● API call parallelization● Hard timeouts● Fault tolerance● Powerful and flexible caching● Visibility● Admin UI● Alert mails● Stateless, async → scalable

Page 7: OCTOPARTS by M3, Inc.

Feature: parallelization

Frontend

BackendX

BackendY

BackendZ

x, y and z please!

x please!

y please!

z please!

Page 8: OCTOPARTS by M3, Inc.

Feature: hard timeouts

Frontend

BackendX

BackendY

BackendZ

x, y and zwithin 500ms

please!

x please!

y please!

z please!

Page 9: OCTOPARTS by M3, Inc.

Feature: hard timeouts

Frontend

BackendX

BackendY

BackendZ

Here’s x and y.z didn’t make it.

500ms later ...

here’s x

here’s y

Page 10: OCTOPARTS by M3, Inc.

Feature: fault tolerance

● Circuit breakers○ If an API appears to be down, don’t bother

contacting it for the next N seconds

Frontend

BackendX

BackendY

BackendZ

x, y and zplease!

Here’s x and y.z didn’t make it.

Page 11: OCTOPARTS by M3, Inc.

Feature: caching

● Supports both TTL and ETag/Last-Modified● Powerful cache invalidation API

○ Cache data indefinitely, invalidate it when necessary○ Cache grouping

■ 1 piece of user data changes → invalidate N different caches

Frontend

BackendX

BackendY

BackendZ

x, y and z please!

Memcached

Quick as a flash,straight from the cache!

Page 12: OCTOPARTS by M3, Inc.

Feature: visibility Real-time Hystrix dashboard

Page 13: OCTOPARTS by M3, Inc.

Kibana (performance, req counts, cache hit rate, ...)

Page 14: OCTOPARTS by M3, Inc.

Implementation● Scala (of course!)● Play Framework● Hystrix● Skinny ORM● Scaldi

● Memcached● Postgresql● Fluentd● Elasticsearch● Kibana

Page 15: OCTOPARTS by M3, Inc.

Moving parts

Elasticsearch

Kibana

Alert mailerscript

Alertmail

MemcachedPostgres Hystrix dashboard

octo1

Play.log

octo2

Play.log

octo3

Play

.log

Tomcat

Page 16: OCTOPARTS by M3, Inc.

Open source

しちゃいますよ。。。

Page 17: OCTOPARTS by M3, Inc.

GitHub https://github.com/m3dev/octopartsDocs http://m3dev.github.io/octopartsDemo http://octoparts.herokuapp.com/

We’re hiring!Come and help us hack on cool stuff with Scala

http://at.m3.com/job


Recommended