7. XML Json
Interfacing Interfacing +
plain GET Intefacing Intefacing
Caching SQL Business Caching
Authorization + Authentication
Business Caching
Caching logic logic
Authorization
Business SQL
Business Business
logic Caching Caching logic
logic
Business
SQL
logic
Caching SQL
SQL Business
SQL logic
Swift SQLSchema
API
Schema Schema
Schema
Mysql
Write DB Mysql DB Mysql DB Mysql DB
Mysql
Reader
Memcache
Mysql Mysql DB Cluster
Readers
7
8. Problems
• Inconsistent
design
&
interfaces
• Unclear
responsibili4es
• Technical
debt
• Independent
teams
developing
the
same
features.
• 7
layers
of
caching
hell
• Scaling
9. Problems
• Inconsistent
design
&
interfaces
• Unclear
responsibili4es
• Technical
debt
• Independent
teams
developing
the
same
features.
• 7
layers
of
caching
hell
• Scaling
not a
problem
:)
18. Interfaces
https post
/user/get/
3rd Party {“auth”:
{“token”: “UwAA_AWeff...”} Highscore
Backend } Service
list
1
get([friends]) Application
User
2 User 2 Interface
Interface
Service
list
get(me)
1
count /application/highscores/
1
Friends
Service
1
User
Service Awards
Service
16
21. definition
User
profile logic Service
template
+ Award
html,
Service
[properties]
18
22. header
definition
User
logo profile Service
logic
template
navigation search + Award
html,
Service
[properties]
18
23. ame.com /
htt p://www.ag
preprocess
...
widget platform
footer ...
home_page
new games
header body
...
definition
User
logo profile Service
logic
template
navigation search + Award
html,
Service
[properties]
18
28. interface JSON Load
balancer
Auth User Award Profile Game
in@erface interface interface widget widget
Protobuf Widget
PlaGorm
service
User User Game Award Award
service service service service service
Protobuf
storage
User Game
Profiles Profiles Games
Award Award
bucket bucket bucket
bucket bucket
Storage
PlaGorm
23
29. How we do it
• Strictly
define
EVERYTHING
• input/output
format,
urls,
• rpc
func4ons,
types,
valida4on
• Strict
rules
on
changes
• Everything
op4onal
• Unless
you’re
really,
really
sure
(and
have
proof!)
• Generate
code
and
documenta4on
• Interface
derived
from
specifica4on
• Documenta4on
derived
from
specifica4on
24
31. What we ended up with…
• Small
applica4ons
running
on
their
own
nodes
• Scale
up
where
necessary
• Many
of
them
on
the
same
machine
• Small
cluster
already
contains
hundreds
of
nodes
26
32. Keeping it connected
• Connec4ng
all
nodes
is
a
bad
idea:
• Not
needed
• Number
of
open
connec4ons
• Solu4on:
use
hidden
nodes
• Each
node
specifies
the
nodes
it
needs.
• How
does
it
scale?
27
34. Router
• Each
applica4on
has
it’s
own
router
• Scans
&
Monitors
• Balances
requests
across
nodes
• Parallelizes
requests
as
much
as
possible
• Applica4on
can
only
talk
to
what
it
has
defined
29
35. But what about response times?
• Use
proper
transports
(Erlang
RPC
vs.
HTTP)
• Yes
there
is
some
transport
overhead
• Typically
<
1ms
per
layer
(+network
latency)
• But
each
layer
has
predictable
response
4mes
• As
long
as
enough
downward
resources
are
available
30
39. Where are we now..
• Interface
layer
has
been
defined
and
largely
implemented
• ImplemenMng
the
service
&
storage
layer
step
by
step
• Meanwhile
we
have
adapters
in
place
• Several
of
the
new
API’s
are
in
use
in
producMon
• First
portals
on
the
new
widget
plaGorm
will
be
deployed
in
the
coming
months
34
40. ... And where we’re going
• Deploying
to
mul4ple
datacenters
this
year
• Bring
elas4city
to
our
deployments
• Decommission
our
“old
architecture”
• Erlang
game
plahorm
35
41. Lessons Learned
• An
architectural
vision
is
crucial
• Integra4ng
into
a
mess
is
a
mess
• Layers
with
clear
responsibili4es
• Strict
communica4on
• Package
small
• Change
is
the
only
constant
• Op4mize
for
predictability
first
36