I-Tier: Dismantling the Monolith Brian McCallister - - PowerPoint PPT Presentation

i tier dismantling the monolith
SMART_READER_LITE
LIVE PREVIEW

I-Tier: Dismantling the Monolith Brian McCallister - - PowerPoint PPT Presentation

I-Tier: Dismantling the Monolith Brian McCallister brianm@groupon.com @brianm 2012 North America CDN nginx Backend Rails DB Service Backend DB MySQL Service Cluster CDN nginx Rails Backend DB Service Backend DB


slide-1
SLIDE 1

I-Tier: Dismantling the Monolith

Brian McCallister

  • brianm@groupon.com

@brianm

slide-2
SLIDE 2

CDN nginx Rails MySQL Cluster Backend Service Backend Service DB DB

2012 North America

slide-3
SLIDE 3

Rails

CDN nginx MySQL Cluster Backend Service Backend Service DB DB

slide-4
SLIDE 4 0% 25% 50% 75% 100% North America January ‘11 January ‘13 October ’12 July ’12 April ’12 January ’12 October ‘11 July ’11 April ’11 March ‘13 June ‘13

Mobile Transaction Mix (% of transactions) Monthly, January 2011 to September 2013

slide-5
SLIDE 5

Rails MySQL Cluster Backend Service Backend Service DB DB API Web Mobile

slide-6
SLIDE 6 EU WebApp PostgreSQL Backend Service Backend Service DB DB EU API Web Mobile NA WebApp MySQL Cluster Backend Service Backend Service DB DB NA API Web Mobile
slide-7
SLIDE 7

Could not build features fast enough

  • Wanted to build features worldwide
  • Mobile and web lacked feature parity
  • Could not change look and feel!
slide-8
SLIDE 8
slide-9
SLIDE 9
slide-10
SLIDE 10 CDN nginx MySQL Cluster Backend Service Backend Service DB DB
slide-11
SLIDE 11 CDN nginx MySQL Cluster Backend Service Backend Service DB DB
slide-12
SLIDE 12
slide-13
SLIDE 13

Subscribe Flow routing Rails MySQL Cluster Backend Service Backend Service DB DB API Web Config

slide-14
SLIDE 14
slide-15
SLIDE 15
slide-16
SLIDE 16
slide-17
SLIDE 17
  • Language files blank comment code
  • CoffeeScript 10 88 251 203

make 1 12 18 25 Bourne Shell 1 1 2 5 Javascript 3 3 3 3 SASS 1 0 0 2

  • SUM: 16 104 274 238
slide-18
SLIDE 18

main: ( {attributes, renderCallback} ) -> # Presenter that sets the layout view = presenters.page 'subscribe', attributes # Grab the list of all the divisions grouponAPI.fetch { endpoint: 'divisions' }, (err, {divisions}, details) -> # If there’s an error, bail and pass the error along return renderCallback err if err?

  • divisionsPresenter = presenters.divisions divisions, {

currentDivision: attributes.query?.division_p }

  • # Add divisions to the page presenter

view.set { divisions: divisionsPresenter }

  • render.pageHtml view, renderCallback
slide-19
SLIDE 19

Within two hours we had a major site outage

slide-20
SLIDE 20
slide-21
SLIDE 21

Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Config

slide-22
SLIDE 22

Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Config

slide-23
SLIDE 23
slide-24
SLIDE 24
slide-25
SLIDE 25
slide-26
SLIDE 26

Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Config

slide-27
SLIDE 27

(cc) Newfrontiers http://flic.kr/p/9u346u

slide-28
SLIDE 28

Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Deal Page Layout Config

slide-29
SLIDE 29 Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Deal Page Layout Config Another Page More Page Yep Page Lots Page
slide-30
SLIDE 30
slide-31
SLIDE 31
slide-32
SLIDE 32
slide-33
SLIDE 33

Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Deal Page Layout Config

slide-34
SLIDE 34
slide-35
SLIDE 35

GET /layout/v3.8/gig_application_layout HTTP/1.1 Accept: */* Accept-Encoding: gzip, deflate, compress Host: uat.groupon.com User-Agent: HTTPie/0.7.2

  • HTTP/1.1 200 OK

Cache-Control: public, max-age=1800 Content-Encoding: gzip Content-Type: application/json; charset=utf-8 Date: Sun, 02 Mar 2014 18:31:01 GMT Transfer-Encoding: chunked

  • {

"templateName": “remote_gig_application_layout_main@v3_8”, "html": "<!DOCTYPE html>\n<!-- : gig_application_layout@v3.8.3 -- >\n<!--[if lt IE 7]> <html class=\"lt-ie10 lt-ie9 lt-ie8 lt- ie7\"{{#htmlAttr}} {{{htmlAttr}}}{{/htmlAttr}}> <![endif]-->\n<!--[if IE 7]> <html class=\"lt-ie10 lt-ie9 lt-ie8\"{{#htmlAttr}} {{{htmlAttr}}}{{/htmlAttr}}> <![endif]-->\n<!--[if IE 8]> <html class=\"lt-ie10 lt-ie9\"{{#htmlAttr}} {{{htmlAttr}}}{{/htmlAttr}}> <! [endif]-->\n<!--[if IE 9]> <html class=\"lt-ie10\"{{#htmlAttr}} {{{htmlAttr}}}{{/htmlAttr}}> <![endif]-->\n<!--[if gt IE 9]><!--> <html class=\"\"{{#htmlAttr}} {{{htmlAttr}}}{{/htmlAttr}}> "data": { … } }

slide-36
SLIDE 36
slide-37
SLIDE 37
slide-38
SLIDE 38

Finish It!

~2 months ~150 Developers

slide-39
SLIDE 39
slide-40
SLIDE 40
slide-41
SLIDE 41
slide-42
SLIDE 42

Forward Looking Statements

A Tale of Two Monoliths

slide-43
SLIDE 43

Rails MySQL Cluster Backend Service Backend Service DB DB API Web Mobile

slide-44
SLIDE 44 EU WebApp PostgreSQL Backend Service Backend Service DB DB EU API Web Mobile NA WebApp MySQL Cluster Backend Service Backend Service DB DB NA API Web Mobile
slide-45
SLIDE 45 EU WebApp PostgreSQL Backend Service Backend Service DB DB EU API Web Mobile Subscribe Page grout Rails MySQL Cluster Backend Service Backend Service DB DB API Web Browse Page Deal Page Layout Config Another Page More Page Yep Page Lots Page

Europe North America

slide-46
SLIDE 46 /users/{user-id}/giftcodes /deals/{deal-id}/breakdowns.json /users/{user-id}/shipping_addresses /users/{user-id}/billing_records /deals/{deal-id} /users/{user-id}/orders/{order-id} … … … Legacy API Global API API Proxy
slide-47
SLIDE 47 /users/{user-id}/giftcodes /deals/{deal-id}/breakdowns.json /users/{user-id}/shipping_addresses /users/{user-id}/billing_records /deals/{deal-id} /users/{user-id}/orders/{order-id} … … … Legacy API Global API API Proxy Customer Facing Service
slide-48
SLIDE 48 Subscribe Page grout EU Webapp PostgreSQL Backend Service Backend Service DB DB EU API Web Browse Page Deal Page Layout Config Another Page More Page Yep Page Lots Page
slide-49
SLIDE 49

Thank You!

Brian McCallister

  • brianm@groupon.com

@brianm

slide-50
SLIDE 50