ALL YOUR API ARE BELONG TO US Paul Hill Everything as a service - - PowerPoint PPT Presentation

all your api are belong to us
SMART_READER_LITE
LIVE PREVIEW

ALL YOUR API ARE BELONG TO US Paul Hill Everything as a service - - PowerPoint PPT Presentation

ALL YOUR API ARE BELONG TO US Paul Hill Everything as a service QCon New York 2014 Paul Hill Architect @ KIXEYE Platform Team APIs to power Social Gaming @paulwilliamhill Building a respectable API under fire An Adventure! starring The


slide-1
SLIDE 1

ALL YOUR API ARE BELONG TO US

QCon New York 2014 Everything as a service Paul Hill

slide-2
SLIDE 2

Architect @ KIXEYE Platform Team

APIs to power Social Gaming @paulwilliamhill

Paul Hill

slide-3
SLIDE 3

An Adventure!

starring The Good The Bad & The Ugly

hypermedia API supporting thousands of requests per second, taking full advantage of the benefits of an asynchronous architecture (Node.js), bi-directional persistent communication channels (websockets), and the performance and flexibility of a document data store (MongoDB) while retaining standards based data validation (JSON-Schema v4), transactional control and error handling (Promises), dynamic documentation (Swagger), efficient caching (Memcached & Varnish), and ease of maintenance (Hypermedia ReST).

Building a respectable API under fire

slide-4
SLIDE 4

The Enrichment Center regrets to inform you that this next test is impossible. Make no attempt to solve it.

The Goal

★ Social graph search ★ Chat ★ Identity (incl. game aliases) ★ Player profiles ★ Friends and following ★ Leaderboards ★ Messaging ★ Avatars ★ Live marketing channel ★ Online presence ★ Player search ★ User account management ★ Real-time player game stats ★ Community management (incl. bans) ★ Groups & Alliances ★ Authentication ○ OAuth2 ○ Facebook Connect ○ Google Auth ★ Game launch canvas ★ Geo-location ★ Name validation ★ Email validation ★ Closed beta invite control ★ Newsfeed ★ Gifting ★ Forums ★ Payments https://api.kixeye.com/api/v2/docs/

slide-5
SLIDE 5

Fear not! I will inspire you all by charging blindly on!

Tail Winds

★ Small team of Rockstar Developers ★ Positive culture + optimism ★ Given a goal, not direction ★ Known traffic patterns ○ ~30MM active players ○ ~120k CCU playing games ○ ~10k - 30k CCU active on web property ★ User experience trumps consistency ★ Time to market trumps cost ★ Over provisioning

slide-6
SLIDE 6

The right man in the wrong place can make all the difference in the world.

The Good

★ ReST ★ JSON Schema v4 ○ Validation ○ zSchema ★ Swagger ○ Live interactive docs ★ Mongo ○ easy JSON storage ★ Promises ○ Error handling guarantees ○ Bluebird ★ Elasticsearch ○ use strict schema ○ ngrams ○ DisMax ★ Measure all the things! ○ Graphite & StatsD ○ ready fire fire fire... ★ Websockets ○ SockJS ★ Easy to grok, fork and patch repos in github ★ CLS (continuation local storage) ○ performance plus ○ encourages reusable functions ★ Automated unit testing by response code ★ 3 tiers (Transport, Logic, Persistence) ★ URI based caching ○ Varnish ○ Memcached ○ focus on problem #1

slide-7
SLIDE 7

War, war never changes.

The Bad ★ Compressed timelines ★ Dynamic requirements ★ Mongo ○ unique constraints limited on sharded collections ○ access pattern outgrew DDS ○ storing relationships ○ write scaling ○ background indexing ★ Load balancing socket.io ★ Performance of overhead of Q ★ V8 ○ gc ○ Poor live profiling tooling ★ Excessive calls from builds to GitHub ★ npm ○ flakey, requires a mirror ★ CLS ○ requires a lot of shims or context is lost ★ Jasmine ○ fails and just keeps on going ○ beware the async setup collision

slide-8
SLIDE 8

I am the vanguard of your destruction.

The Ugly ★ Natural key based load balancing (The Aggregator) ★ Back pressure ★ Memory leaks ○ Thrift JS - oneway void - Flume ○ Default error handling in libs ○ Q long stack traces ★ Insane default configuration in libs ★ Supernodes ○ $in ★ Reactive cascade failure ○ Default retry ○ true exponential back off with no cap ○ Node Zookeeper heartbeat timeout ○ gc behaviour under stress ○ load rebalancing

slide-9
SLIDE 9

Join Us

kixeye.com/jobs