conventions between applications

48
Conventions Between Applications Michael Ries @mmmries

Upload: michael-ries

Post on 12-Aug-2015

402 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Conventions between applications

Conventions Between Applications

Michael Ries @mmmries

Page 2: Conventions between applications
Page 3: Conventions between applications

http://www.rubyfuza.org/images/speakers/2015/charles_nutter.jpghttps://scontent-sjc.cdninstagram.com/hphotos-xaf1/t51.2885-15/10838508_854030257976849_260521776_n.jpg

Page 4: Conventions between applications
Page 5: Conventions between applications

Distributed System?Made of multiple applications working together

Page 6: Conventions between applications

2012 => 254 deploys/yr 2014 => 1,884 deploys/yrWhat we learned along the way

everywhere on the internet

Page 7: Conventions between applications

Make a DirectoryPublish Events

Deploy Small Changes

Page 8: Conventions between applications

Sample Project

When a user is deleted we will cleanup their data

Page 9: Conventions between applications

Abacus Amigo

Sherlock BallistaDispatch

Bunyan

Grunt

Newman PersonaRelay Synchro

HulkWormholeFirefly Dunaway AlfredBatcave

Bullseye

Page 10: Conventions between applications

The Directory

Easily Navigable by Humans Used By Production Code

http://media.tumblr.com/f9b5d822e963e6f6fc7fe7008b5ee8aa/tumblr_inline_mhbi8egCJz1qz4rgp.gif

Page 11: Conventions between applications

Atlas - The Directory

Protobuf (https://developers.google.com/protocol-buffers/) Map Resources to Applications Private Gem

Page 12: Conventions between applications
Page 13: Conventions between applications
Page 14: Conventions between applications

Message Schema Migrations

Backwards Compatible Changes

Deprecations => Backwards Incompatible Changes

Page 15: Conventions between applications

User (1.0.0)

guid name

Page 16: Conventions between applications

User (1.0.0)

guid name

Amigo NewmanUserSearch

User (1.0.0)

Page 17: Conventions between applications

User (1.0.0)

guid name

Amigo Newman

User (1.1.0)

guid name email

UserSearch

User (1.1.0) ?✔

Page 18: Conventions between applications

User (1.0.0)

guid name

Amigo Newman

User (1.1.0)

guid name email

Page 19: Conventions between applications

User (1.0.0)

guid name

Amigo Newman

User (2.0.0) guid name email

first_name

UserSearch

User (2.0.0) ?X

Page 20: Conventions between applications

User (1.0.0)

guid name

Amigo Newman

User (1.2.0) guid

name (deprecated) email

first_name

Page 21: Conventions between applications

User (1.0.0)

guid name

Amigo Newman

User (1.2.0) guid

name (deprecated) email

first_name

UserSearch

User (1.2.0) ✔

Page 22: Conventions between applications

Newman

User (1.2.0) guid

name (deprecated) email

first_name

newman$ rspec.........DEPRECATION WARNING: Atlas::Amigo::User#name field usage is deprecated. (called from update at /Users/hqmq/code/newman/app/services/atlas/newman/notification_service.rb:26)

Page 23: Conventions between applications

The DirectoryNavigable by Team Members Used by Production Code Message Schema

Well-defined Migration Semantics

Page 24: Conventions between applications

Abacus Amigo

Sherlock BallistaDispatch

Bunyan

Grunt

Newman PersonaRelay Synchro

HulkWormholeFirefly Dunaway AlfredBatcave

Bullseye

Page 25: Conventions between applications

Amigo

User

Client

Page 26: Conventions between applications

Amigo

User

Abacus

AccountX X

Page 27: Conventions between applications

Amigo

User

Abacus

AccountX X

Newman

Notification

Persona

MemberX X

https://pbs.twimg.com/profile_images/2694242404/5b0619220a92d391534b0cd89bf5adc1_400x400.jpeg

Page 28: Conventions between applications

Events

Low Coupling Similar To Controller

Page 29: Conventions between applications

Amigo

User

Abacus

AccountX X

Newman

Notification

Persona

MemberX X

Page 30: Conventions between applications

Amigo

User X

amigo.user.deleted

Page 31: Conventions between applications

Amigo

User

Abacus

Account

Newman

Notification

Persona

Member

X X

X

X

Page 32: Conventions between applications

Abacus

Newman

Persona

Firefly

Page 33: Conventions between applications

Abacus

Abacus

Abacus

Abacus

Abacus

Abacus

Abacus

Abacus

Abacus

Page 34: Conventions between applications

ActionSubscriber

https://github.com/moneydesktop/action_subscriberhttp://hackers.lookout.com/images/jruby_large.png

https://cdn.tutsplus.com/net/uploads/legacy/ 966_essentialReading/images/rubylang.png

Page 35: Conventions between applications

class UserSubscriber < ActionSubscriber::Base

def deleted user = payload # Atlas::Amigo::User

delete_accounts_for_user(user.guid) end

end

Page 36: Conventions between applications

ActionPublisher

Coming Soon…

Page 37: Conventions between applications

ActionPublisher

class User < ActiveRecord::Base include ActionPublisher::Syncable

... other code ... end

Page 38: Conventions between applications

EventsLow Coupling Similar To Controller Opt-in To Messages 1 Message Per Application

Page 39: Conventions between applications

Amigo

User

Abacus

Account

Newman

Notification

Persona

Member

X X

X

X

Page 40: Conventions between applications

Amigo Abacus Persona

Publish user.deleted message

Cleanup Accounts

on user.deleted

Cleanup Members

on user.deleted

Newman

Cleanup Notifications

on user.deleted

Page 41: Conventions between applications

4 Tasks???

Cohesive Code Code Review Deploys Overhead

Page 42: Conventions between applications

Deployment CostsDeveloper Time Developer Interruption System downtime

Page 43: Conventions between applications

Zero-Downtime Matters

2012 2013 2014254 Deploys 1,597 Deploys 1,884 Deploys

Zero Downtime Implemented

Page 44: Conventions between applications

TrebuchetExtension to Capistrano Deploy 1-by-1 Deploy in groups

Page 45: Conventions between applications

Small DeploysCohesive Codebases Automate Deploys Minimize Cost (interruption/time) Minimize Risk

Code Review++

Page 46: Conventions between applications

Make a DirectoryPublish Events

Deploy Small Changes

Page 47: Conventions between applications

Team >> TechShared Ownership Teaching / Learning Discipline

http://gifrific.com/wp-content/uploads/2012/04/Punch-After-Celebration.gif

Page 48: Conventions between applications

End

Michael Ries @mmmries