don't fear the walking dead @ ipc 2016

56
HOW WE GET RID OF OUR MONOLITH DON’T

Upload: techkartenmacherei

Post on 21-Mar-2017

234 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Don't fear the Walking Dead @ IPC 2016

HOW WE GET RID OF OUR MONOLITH

DON’T

Page 2: Don't fear the Walking Dead @ IPC 2016
Page 3: Don't fear the Walking Dead @ IPC 2016
Page 4: Don't fear the Walking Dead @ IPC 2016
Page 5: Don't fear the Walking Dead @ IPC 2016

How we started• built on top of a standard e-commerce platform

• a lot of custom code to support a wide combination of product options

Feature X Feature Y Feature Z

Core Code Customization

Page 6: Don't fear the Walking Dead @ IPC 2016

The challenges of a growing business

• serious performance issues

• own developers don’t feel comfortable with the code

• adding individual features is too complex

• upgrading is hard

Page 7: Don't fear the Walking Dead @ IPC 2016

Finding a way out

Page 8: Don't fear the Walking Dead @ IPC 2016

You don’t have to replace everything at once!

Page 9: Don't fear the Walking Dead @ IPC 2016

What part of the software causes the highest amount of pain?

• category pages

• product detail pages

Page 10: Don't fear the Walking Dead @ IPC 2016

Planning

Page 11: Don't fear the Walking Dead @ IPC 2016

Traditional Architecture

PHP Application

Session Storage

RDBMS

Webserver

PIM / ERP

Page 12: Don't fear the Walking Dead @ IPC 2016

Incoming Request

PHP Application

Session Storage

RDBMS

Webserver

PIM / ERP

Page 13: Don't fear the Walking Dead @ IPC 2016

Caching

PHP Application

Session Storage

RDBMS

Webserver

PIM / ERP

Cache

Page 14: Don't fear the Walking Dead @ IPC 2016

Caching

PHP Application

Session Storage

RDBMS

Webserver

PIM / ERP

Cache

Page 15: Don't fear the Walking Dead @ IPC 2016

Our Initial Setup

Legacy System

Session Storage

RDBMS

Webserver

PIM / ERP

Cache

Page 16: Don't fear the Walking Dead @ IPC 2016

Idea

Legacy System

Session Storage

RDBMS

Webserver New Software

Page 17: Don't fear the Walking Dead @ IPC 2016
Page 18: Don't fear the Walking Dead @ IPC 2016
Page 19: Don't fear the Walking Dead @ IPC 2016

FURY Frontend Key-Value Store

getCategoryPage('hochzeit');

"<html><head>…</head><body>…</body></html>"

Page 20: Don't fear the Walking Dead @ IPC 2016
Page 21: Don't fear the Walking Dead @ IPC 2016

FURY Frontend

Key-Value Store

["SBU06HE"

,"TEOD3HE"

,"ANW04HD"

]

Search

search("{'

category':

'hochzeit'

, 'filters

':{}}");

getTiles(["SBU06HE","TEOD3HE","ANW04HD"]);

["<div class="category-item">…</div>", …]

Page 22: Don't fear the Walking Dead @ IPC 2016

CQRS-based Architecture

PHP Frontend

Session Storage

Webserver Key/Value Store PHP Backend

PIM / ERPSearch Engine

Page 23: Don't fear the Walking Dead @ IPC 2016

Incoming Request

PHP Frontend

Session Storage

Webserver Key/Value Store PHP Backend

PIM / ERPSearch Engine

Page 24: Don't fear the Walking Dead @ IPC 2016

New Data

PHP Frontend

Session Storage

Webserver Key/Value Store PHP Backend

PIM / ERPSearch Engine

Page 25: Don't fear the Walking Dead @ IPC 2016

Webserver

Key-Value Store

Search

FURY Frontend FURY Backend

FURY Components

Page 26: Don't fear the Walking Dead @ IPC 2016

Webserver

Key-Value Store

Search

FURY Frontend FURY Backend

Legacy RDBMSLegacy System Session

Storage

Collect & Export

K-V Store

Page 27: Don't fear the Walking Dead @ IPC 2016

Webserver

Key-Value Store

Search

FURY Frontend FURY Backend

Legacy RDBMSLegacy System

FURY Requests

200 OK

Session Storage

K-V Store

Page 28: Don't fear the Walking Dead @ IPC 2016

Webserver

Key-Value Store

Search

FURY Frontend FURY Backend

Legacy RDBMSLegacy System

Requests to Legacy System

404 NOT FOUND

Session Storage

K-V Store

Page 29: Don't fear the Walking Dead @ IPC 2016

Webserver

Key-Value Store

Search

FURY Frontend FURY Backend

Legacy RDBMSLegacy System

Requests to Legacy System

404 NOT FOUND

200 OK

Session Storage

K-V Store

Page 30: Don't fear the Walking Dead @ IPC 2016

Learnings• we have full responsibility now

• no framework needed

• no relational database needed

• accessing the legacy session storage was too slow

• solved by adding a read slave for FURY

Page 31: Don't fear the Walking Dead @ IPC 2016

Goods and Bads• three months of development until first launch

• fully object-oriented

• easy refactoring thanks to 100% code coverage

• not enough automated acceptance tests

• dependencies to legacy software (database changes, API calls)

Page 32: Don't fear the Walking Dead @ IPC 2016

A/B Deployment

Page 33: Don't fear the Walking Dead @ IPC 2016

Webserver (Router)

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver

FURY Frontend

Server B

K/V StoreSearch

FURY Backend

Page 34: Don't fear the Walking Dead @ IPC 2016

Webserver (Router)

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver

FURY Frontend

Server B

K/V StoreSearch

FURY Backend

active = A

Page 35: Don't fear the Walking Dead @ IPC 2016

Webserver (Router)

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver

FURY Frontend

Server B

K/V StoreSearch

FURY Backend

active = B

Page 36: Don't fear the Walking Dead @ IPC 2016

Webserver (Router)

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

active = B

Page 37: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

active = B

Page 38: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

Collect & Export

active = B

Page 39: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

Collect & Export

Smoke Tests

active = B

Page 40: Don't fear the Walking Dead @ IPC 2016

Smoke Tests<?php namespace Kartenmacherei\IPC2016;

use PHPUnit_Framework_TestCase;

class SmokeTest extends PHPUnit_Framework_TestCase { /** * @dataProvider furyUrlProvider * * @param Url $url */ public function testFuryUrl(Url $url) { $result = $this->sendGetRequest($url);

$this->assertSame(200, $result->getStatusCode()); $this->assertNotEmpty($result->getBody()); $this->assertLessThanOrEqual(100, $result->getTimeToFirstByteInMilliseconds()); }

Page 41: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

Collect & Export

Smoke Tests

active = B

Page 42: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

Collect & Export

Smoke Tests

active = B

Page 43: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

Webserver (Router)

Build Server

Deploy Code

Collect & Export

Smoke Tests

Switch to A

active = A

Page 44: Don't fear the Walking Dead @ IPC 2016

RDBMS Read Slave

Webserver

FURY Frontend

Server A

K/V StoreSearch

FURY Backend

active = B Webserver (Router)

Build Server

Deploy Code

Collect & Export

Page 45: Don't fear the Walking Dead @ IPC 2016

What's next?

Page 46: Don't fear the Walking Dead @ IPC 2016

Client

/product

Page 47: Don't fear the Walking Dead @ IPC 2016

Client

/checkout/cart

Page 48: Don't fear the Walking Dead @ IPC 2016

Client

/checkout/basket

Basket Service

Page 49: Don't fear the Walking Dead @ IPC 2016

Client

/checkout/basket

BasketService

Page 50: Don't fear the Walking Dead @ IPC 2016

Next steps• open-source our CQRS RESTful Framework

• replace the next parts of the legacy system with new, self-contained components / services

Page 51: Don't fear the Walking Dead @ IPC 2016
Page 52: Don't fear the Walking Dead @ IPC 2016

Next steps• open-source our CQRS RESTful Framework

• improve our deployment process

• replace the next parts of the legacy system with new, self-contained components / services

Page 53: Don't fear the Walking Dead @ IPC 2016
Page 54: Don't fear the Walking Dead @ IPC 2016

Next steps• open-source our CQRS RESTful Framework

• improve our deployment process

• replace the next parts of the legacy system with new, self-contained components / services

Page 55: Don't fear the Walking Dead @ IPC 2016

"one hundred fifty-seven quinvigintillion, seven hundred eighty-six quattuorvigintillion, six hundred fifty-seven trevigintillion, seven hundred

forty-seven duovigintillion, three hundred forty unvigintillion, one hundred eighty-six vigintillion, (…) nine hundred forty-five quintillion, eight hundred

twenty-eight quadrillion, two hundred seventy trillion, eighty billion, …"

Page 56: Don't fear the Walking Dead @ IPC 2016

Q&A

https://www.facebook.com/kartenmacherei/

[email protected]

http://www.kartenmacherei.de/recruiting

https://tech.kartenmacherei.de/

@techdotkam