Architecture in Motion How Adyen achieved 100x Bert Wolters - EVP - - PowerPoint PPT Presentation

architecture in motion
SMART_READER_LITE
LIVE PREVIEW

Architecture in Motion How Adyen achieved 100x Bert Wolters - EVP - - PowerPoint PPT Presentation

Architecture in Motion How Adyen achieved 100x Bert Wolters - EVP Technology bert@adyen.com Traditional vs Today Customers are in full control $1B 80% On Singles Day in China, $1Billion was On Black Friday in the U.S., nearly 80% of


slide-1
SLIDE 1

Architecture in Motion

How Adyen achieved 100x

Bert Wolters - EVP Technology
 bert@adyen.com

slide-2
SLIDE 2

Traditional vs Today

Customers are in full control

slide-3
SLIDE 3

80%

On Black Friday in the U.S., nearly 80% of retailers’

  • nline traffic took place on mobile.

$1B

On Singles’ Day in China, $1Billion was processed in 1 minute and 25 seconds

slide-4
SLIDE 4

Companies face a lack of functionality, flexibility and innovation

Stuck with legacy technology that lead to poor user experience.

slide-5
SLIDE 5

One modern platform

Traditional value chain

Merchant Gateway Risk management Processing Schemes Issuers PSP Acquirer

slide-6
SLIDE 6

This is Adyen

ALL TECHNOLOGY DEVELOPED IN-HOUSE One platform, one contract, all sales channels 250+ payment methods 1200+ global employees 23 Global offices

slide-7
SLIDE 7
slide-8
SLIDE 8

"Adyen is the best fit for global merchants that want to increase their overall payments performance, reduce their fraud rates and simplify their overall payments operations” “The company behind Facebook, Uber and Netflix payments reveals huge transaction growth”

75 150 225 300 2012 2013 2014 2015 2016 2017 2018 2019 Adyen’s total transaction volume in $ billion

slide-9
SLIDE 9

We prioritize current merchant experience


  • ver future features

To think like the merchant we 
 go meet them We design for 20x Expose your work early We are all designers, architects, 
 coders, testers, security officers 
 and operations engineers We all make mistakes, but we seek help 
 as soon as we find out You own when, where and how 
 your code goes live Your code should be understandable 
 at 4am under stress We embrace new technology 
 when it has clear benefits Our tech stack is open source or built in-house

The Adyen Way of Engineering

slide-10
SLIDE 10

We prioritize current merchant experience


  • ver future features

To think like the merchant we 
 go meet them We design for 20x Expose your work early We are all designers, architects, 
 coders, testers, security officers 
 and operations engineers We all make mistakes, but we seek help 
 as soon as we find out You own when, where and how 
 your code goes live Your code should be understandable 
 at 4am under stress We embrace new technology 
 when it has clear benefits Our tech stack is open source or built in-house We design for 20x

The Adyen Way of Engineering

slide-11
SLIDE 11

We prioritize current merchant experience


  • ver future features

To think like the merchant we 
 go meet them We design for 20x Expose your work early We are all designers, architects, 
 coders, testers, security officers 
 and operations engineers We all make mistakes, but we seek help 
 as soon as we find out You own when, where and how 
 your code goes live Your code should be understandable 
 at 4am under stress We embrace new technology 
 when it has clear benefits Our tech stack is open source or built in-house Expose your work early

The Adyen Way of Engineering

slide-12
SLIDE 12

We prioritize current merchant experience


  • ver future features

To think like the merchant we 
 go meet them We design for 20x Expose your work early We are all designers, architects, 
 coders, testers, security officers 
 and operations engineers We all make mistakes, but we seek help 
 as soon as we find out You own when, where and how 
 your code goes live Your code should be understandable 
 at 4am under stress We embrace new technology 
 when it has clear benefits Our tech stack is open source or built in-house Our tech stack is open source or built in-house

The Adyen Way of Engineering

slide-13
SLIDE 13

We prioritize current merchant experience


  • ver future features

To think like the merchant we 
 go meet them We design for 20x Expose your work early We are all designers, architects, 
 coders, testers, security officers 
 and operations engineers We all make mistakes, but we seek help 
 as soon as we find out You own when, where and how 
 your code goes live Your code should be understandable 
 at 4am under stress We embrace new technology 
 when it has clear benefits Our tech stack is open source or built in-house

The Adyen Way of Engineering

slide-14
SLIDE 14

High-Level Architecture

(Bibit / pre-Adyen)

DB

main accounting database Public API app servers Shopper payment flow, Risk analysis, Payment authorization
 Reconciliation, Reporting


slide-15
SLIDE 15

High-Level Architecture

(pre-Adyen)

DB

??? ??? main accounting database Public API app servers

slide-16
SLIDE 16

High-Level Architecture

(pre-Adyen)

DB

Availability Consistency main accounting database Public API app servers

slide-17
SLIDE 17

Design for Breakage

slide-18
SLIDE 18

High-Level Architecture

(first years)

accounting app servers

DB

main accounting database Stateless Statefull Public API app servers Asynch queues

slide-19
SLIDE 19

Front-end Maintenance

slide-20
SLIDE 20

Database Maintenance

slide-21
SLIDE 21

High-Level Architecture

(first years)

accounting app servers

DB

main accounting database Stateless Statefull Public API app servers

slide-22
SLIDE 22

DB

main accounting

Consequences of being Stateless

accounting app Public API app servers Stateless Statefull Statefull Async Notification

slide-23
SLIDE 23

Consequences of being Stateless

Refunds

Request: { "merchantAccount" : "TestMerchant", "modificationAmount" : { "value" : 500, "currency" : "EUR" }, "originalReference" : "9313547924770610", "reference" : "YourModificationReference" } Response: { "pspReference" : "8312534564722331", "response" : "[refund-received]" }

slide-24
SLIDE 24

Architecture Diagram – Authorisations

Acquiring Network Notification Notification Soap (XML) Soap (XML) REST (HTTP POST or JSON) Merchant Customer Banking Network PAL HPP Risk Shopper DNA Recharge Vault Accounting Data Warehouse ACM PSP

slide-25
SLIDE 25
slide-26
SLIDE 26

The Challenge

accounting app servers

DB

main accounting database Public API app servers

slide-27
SLIDE 27

Growing Exponentially


  • ver $100b processed annually

+

slide-28
SLIDE 28

Scalability Challenges

API (micro)services designed to be highly redundant and stateless. Scale linearly with more hardware. However main payment accounting system was running > 70TB on a single PostgreSQL instance at up to 25k tps. At 2-4x, optimisation and/or bigger hardware solve the problem. At 20x this is no longer sufficient and requires re- architecting.

slide-29
SLIDE 29

Marbles

slide-30
SLIDE 30

Generating Reports/Batch Files

slide-31
SLIDE 31

The Solution / The NEW Challenge

front end app servers (public API)

DB DB DB

multiple accounting clusters

slide-32
SLIDE 32

More jars…

slide-33
SLIDE 33

PspReference

Refunds

Request: { "merchantAccount" : "TestMerchant", "modificationAmount" : { "value" : 500, "currency" : "EUR" }, "originalReference" : "9313547924770610", "reference" : "YourModificationReference" } Response: { "pspReference" : "8312534564722331", "response" : "[refund-received]" }

slide-34
SLIDE 34
slide-35
SLIDE 35

Streaming Framework

Accounting DB’s should be insert only 
 Reduce I/O and CPU in the main DB (cache thrashing / spilling to disk) 
 Exactly once delivery (Kafka started to support this since 2017) Prevent multi-shard queries

slide-36
SLIDE 36

Stream
 Contents

"@type" : "com.adyen.protocol.stream.journalstream.JournalStreamItem", "journalStreamItemType" : "Journal", "journal" : { "bookingDate" : 1493908683696, "journalId" : 227274316270, "postDate" : 1493908682341, "lines" : [ { "registerTypeId" : 23, "quantity" : 10500, "accountId" : 378293, "batch" : { "accountId" : 378293, "periodEndDate" : 1493935200000, "registerTypeId" : 23, "batchId" : 506220414, "periodBeginDate" : 1493848800000 }, "unitId" : 840, "journalLineId" : 117964524937, "batchId" : 506220414 }, 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

slide-37
SLIDE 37

Streaming is an Idempotent Log

StreamId Key Value 1 2 3 4 aa ab ad ba … … … ba94c3… 8d3ffc… 457e18… cc78c2…

Sequence generated by stream on insert; identifies offset

Stream

Unique key provided by producer to prevent duplicates; allows
 idempotency
 (exactly once delivery) Value is a byte array which contains the raw data

slide-38
SLIDE 38

Producer 1 Producer 2 Producer 3

Streaming cluster

Partition 1 Partition 2 Partition 3

Consumer 1 Consumer 2 Consumer 3 Consumer 4

A stream consists of multiple partitions

slide-39
SLIDE 39

Streaming cluster

Consumer

Partition readers

Streamreader

Single stream

  • f records

consumer

Auto-discovery of partitions by streamreader Partitionreaders keep track of position and deserialize items

Partition 1 Partition 2 Partition 3

Streamreader hides complexity of reading partitions

slide-40
SLIDE 40

AbstractConsumer communicates with streamreader and keeps track of consumerState

Consumer

Streamreader YourConsumer

(extends AbstractConsumer)

AbstractConsumer

abstract void consume(records) abstract boolean shouldPersist() abstract PersistFunction persistInternal()

Consumer database

persist() poll() Does not block consuming (asynchronous)

Consumer- State

Extend AbstractConsumer to implement a new consumer

slide-41
SLIDE 41

Implementation

  • Built on PostgreSQL (ACID)
  • Denormalised data consumes lots of

bandwidth/storage

  • Very fast (de)serialisation and compact

serialised representation

  • Using FastJSON (Alibaba) with Zstandard

(Facebook) compression achieves similar performance/byte size

  • Still produces > 200Gb/day!
slide-42
SLIDE 42

Putting it into Production

slide-43
SLIDE 43

Results after Deployment

First customers live on multi-cluster in January 2017 with no customer impact Streaming handles virtually all data functions which would have required multi-cluster queries. DB tps on primary cluster dropped from 25k to 8k in less than two months

slide-44
SLIDE 44

Hong Kong Singapore Amsterdam/Zwolle (3DC’s) Miami San Fransisco

Global Data Centers

Melbourne Sydney

Leased lines: MPLS links

slide-45
SLIDE 45

Improving Latency and Resilience

  • Multiple data centers per region to provide

resilience against internal and external issues 


  • Merchants connect into data center in their
  • wn geographical region minimising latency

and hops over public internet 


  • Sysmon recovery and health-based rerouting

choose optimal path for each transaction

slide-46
SLIDE 46

Architecture in Motion

How Adyen achieved 100x