Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the...

28
/GrandParadePoland www.grandparade.co.uk Gaming and Betting Sławek Zajac, Technical Director at Grand Parade (a William Hill company) Distributed computing Enterprise challenges

Transcript of Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the...

Page 1: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

/GrandParadePoland www.grandparade.co.uk

Gaming and Betting

Sławek Zajac, Technical Director at Grand Parade (a William Hill company)

Distributed computing Enterprise challenges

Page 2: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Agenda

overview of the industry [from a technical perspective ]

influences on design and architecture

discussion of Betting with Actors

Platform Considerations

Page 3: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion
Page 4: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Betting Today

Poker

Blackjack

Casino/Slots

Sports

Page 5: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Example: Tennis

Federer vs Nadal, 5th set Australian Open 2017

Nadal leads 3:2 in the fifth

Federer breaks to 3:3

Page 6: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

View of the data

Events Feeds Busines Process Consumers

500 Bets / Sec

5M price changes/day 160TB/day

Ephemeral Markets Peaky

Internal & External

Page 7: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Entertaining

Choose Responsive to provide entertainment

Immersive

Responsive

Analysis

Response Times

Page 8: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Trust

Resilience to build trust

Resilient

Analysis

Replication

Isolation

Page 9: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Profitable

Elasticity and Message Driven to drive profitability

Message Driven

Analysis

Scalable

Availability First

Elastic

Page 10: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Guiding Principles

Responsive

Resilient

Message Driven

Elastic

Respond in a timely manner

Stay responsive in face of failuresStay responsive under different workloads

How to achieve Elasticity/Resiliency/Responsiveness

Page 11: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Provide the means of composing different feeds

Compose in a distributed system

Provide fault tolerance

error.log

awk

sort

grep

Unix philosophy

Page 12: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Composing Feeds

Settlements

Bets

Prices

Results

Page 13: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Betting Engine

Place

Capture

Cash-In

Result

Settlement

User

Page 14: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

AgendaA core business process that needs to evolve

Actor Model Case Study

Page 15: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Actors

Joe’s Bet

Selection Erlang to Win

Page 16: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Actors

Joe’s Bet

Selection Erlang to Win

Fred’s Bet

Selection Scala to Win

Martin’s Bet

Page 17: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Actors

Fred’s Bet

Selection Erlang to Win

Joe’s Bet

250K

Page 18: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion
Page 19: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Outcome

Concurrency was good 10M processes in a VM (vertical scalability)

Memory 65GB or RAM (usual Grand National traffic)

250K messages sent from one selection [ slow ] (x 1K) = 250M

supervision hard (for 250K children), looked at sharding

Page 20: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Key realization

Modelling Bet tree structure with Actors for changing state is problematic.

Millions [up to 250M] of messages flowing in bursts creates problems

Next step [ Actors as units of computation ]

Page 21: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Next Iteration

Selection Update Erlang to Win

ActorActor

ActorActor

ActorActor

ActorActor

Memory Cache

Memory Cache

Page 22: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Results

Usage of RAM decreased significantly [ 2GB ]

Achieved good level of concurrency (with sharding)

Likely the way forward but need to think about how to achieve concurrency effectively [ tricky edge cases to solve ]

Page 23: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Personalization

Page 24: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Omnia Platform (Lambda Architecture)

Chr

onos

(D

ata

Sour

ce)

NeoCortex (Speed Layer)

Fates (Batch Layer)

Herm

es (Serving Layer)

https://www.lightbend.com/resources/case-studies-and-stories/uks-online-gaming-leader-bets-big-on-reactive-to-drive-real-time-personalization

Page 25: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Enterprise Challenge (not a solution challenge)

Provide common platform for services [betting, personalization]

Enable service communication and composability

Maintain consistent design principles

Page 26: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Provide a foundation and patterns

Message Fabric (Kafka, Akka

Cluster)Consumers

Business Domain

Domain Data Stores

(Cassandra)

API Gateway

External Integrators

Page 27: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

Key considerations going forward

Conway’s law (and the reverse)

CQS, CQRS, Event Sourcing, DDD, Messaging contracts (need to be upheld by all)

Scala can be a challenge so continuous learning is necessary

Front-End cannot be an afterthought

Page 28: Gaming and Betting - Lambda Days · Gaming and Betting Sławek Zajac ... Agenda overview of the industry [from a technical perspective ] influences on design and architecture discussion

SummarySummary & Q&A