SlideShare a Scribd company logo
1 of 28
Download to read offline
DragonCraft
Architectural Overview
       Freeverse Inc.
Jesse Sanford, Joshua Kehn
Freeverse / ngmoco:) / DeNA
● Web guys brought in to design RESTful
  HTTP based games for handheld clients.
● Platform concurrently being built by Ngmoco
  team out in San Francisco.
● First games in company's history built
  entirely on
   ○ EC2
   ○ Node.js
   ○ MongoDB
● There is a lot of firsts here!
Why Node.js?
● Already using javascript. Knowledge share!
● Fast growing ecosystem.
● Reasonable to bring libraries from client to
  server and vice versa.
● Lots of javascript patterns and best practices
  to follow.
● Growing talent pool.
Why MongoDB?
● Ever changing schemas make document
  stores attractive.
● Easy path to horizontal scalability.
● 10gen is very easy to work with.
● Lots of best practice patterns for running on
  ec2 infrastructure.
● Javascript is a friendly interface.
Handling the change.
● Lots of patience.
● Many proof of concepts.
● Dedicated poc's for different puzzle pieces.
  (Platform services, Game Libraries)
● Developer training and evangelists.
● Performance testing and open source library
  vetting.
● Lots of patience. Seriously.
Building from scratch.
●   Lots of testing.
●   Pre-flight environment for content.
●   Duplicate of production for release staging.
●   Full stack developer sandboxes on every
    workstation.
    ○ Individual MongoDB and Node.js instances running.
    ○ Full client stack available as a browser based
      handheld simulator for client interface.
"Physical" Infrastructure
● EC2 fabric managed by Rightscale
● Extensive library of "Rightscripts" and
  "Server templates".
● Different deployments for each environment.
● Deployments a mix of single service
  machines and arrays of machines.
● Arrays load balanced by HA proxy not ELB's
● Mongo clusters are largest expense.
Logical Diagram
Physical/Logical Diagram
Mongo Infrastructure
● Mongo cluster per environment.
● 3 config nodes split between 2 availability
  zones.
● Currently only 1 shard.
● 3 db nodes split between 2 availability
● mongos processes running directly on app
  servers.
Mongo Infrastructure cont.
● Config nodes on t1-micros.
● DB nodes on m1-xlarges.
● DB nodes running raid 10 on ebs.
● XFS with LVM.
● Snapshots taken after forcing fsync and lock
  on db and then XFS freeze.
● Backups always done on secondary.
Shrinking Mongo
● Staging and testing environments too costly.
● Logically the application knows no
  MongoD/S differences.
● Still single shard.
● Spinning instances is quick.
● Only used for smoke testing at the end of
  every dev cycle.
● Moving to single master -> slave replication.
● Cost savings of 60% in these environments.
Other Services
● HA-proxy 2 m1-small
● Memcached - 1 m1-large
● PHP+Apache (cms), Flume/Syslog - 1 m1-
  large
● Ejabberd - 1 m1-large
● Beanstalkd - 1 m1-large
● Nodejs - (currently 3) c1-xlarge
Log4js-syslog, Flume
● Centralized logging from all application
  servers in the cluster.
● Configurable log levels at both the
  application layer and filters on the stream
  after that.
● Flume speaks syslog fluently
● Flume allows us to point the firehose
  wherever we want.
● It's trivial to ingest the Flume ouput from s3
  into Hadoop/Elastic Map Reduce
Daida, Beanstalkd
● Needed fast worker queue for push
  messaging and out-of-band computation.
● Considered Redis and Resque
● Considered RabbitMQ/AMPQ
● Beanstalkd was built for work queues.
● Beanstalkd is very simple.
● No real support for HA
● Workers needed to be written in javascript.
● No upfront knowledge about the runtime
  activities of workers.
Daida, Beanstalkd cont.
● Developers define jobs (payload contains
  variables needed for job to execute)
● Developers schedule jobs.
● Developers create "strategies" which know
  how to execute the jobs.
● At runtime using some functional magic
  Daida closes the developer defined strategy
  around the payload variables that came with
  the job.
● This is somewhat similar to the job being run
  by a worker inside a container with a
Daida handler example.
 var handlers = {
    bar: function(data, cb) {
       var callback = cb || function() { /* noOp */ }; //if callback wasn't passed
       console.log('test job passed data: ' + JSON.stringify(data));
       callback(); //always make sure to callback!!!!
    },

    foo: function(data, cb) {
       var callback = cb || function() { /* noOp */ };
       console.log('foo job passed name'+ data.name);
       callback(); //again never forget to callback!!!
    },
  };
  exports.handlers = handlers;

  exports.bar = handlers.bar;
  exports.foo = handlers.foo;

//taken from https://github.com/ngmoco/daida.js
Ejabberd
● Best multi-user-chat solution for the money.
● Considered IRC and other more custom
  solutions.
● Javascript handhelds can use javascript chat
  client libraries!
● Capable of being run over plain HTTP.
  (Comet/long-poll/BOSH)
● Widely used.
● Fine grained control over users and rooms.
● A little complex for our needs.
● Erlang/OTP is solid.
Other Nodejs libraries
●   Connect
●   Express
●   mongoose
●   oauth
●   connect-auth
●   connect-cookie-session
Megaphone load tester
● Written in erlang/otp to make use of it's
  lightweight processes and distributed nature.
● SSL Capable HTTP Reverse proxy.
● Records sessions from handhelds.
● Proxy is transparent and handhelds are
  stupid.
● Choose which sessions to replay.
● Write small scripts to manipulate req/resp
  during replay. OAuth handshakes?
● Interact with replay in console.
● Record results of replay.
Megaphone load tester cont.
● Replay in bulk! (Load test).
● Centralized console can spawn http replay
  processes on many headless machines.
  Similar to headless Jmeter.
● A single session (some number of individual
  requests) is sent to the client process when
  spawned
● Responses are sent back to the centralized
  databases as clients receive them.
● The same session can be sent to multiple
  clients and played back concurrently.
%% This module contains the functions to manipulate req/resp for the dcraft_session1 playback
-module(dcraft_session1).
                                                                                                   EX. Session handler
-include("blt_otp.hrl").                                                                           script for
-export([ create_request/1, create_request/2, create_request/3]).
-record(request, { url, verb, body_vars}).                                                         manipulating
-record(response, {request_number, response_obj}).
create_request(Request) -> create_request(Request, []).
                                                                                                   requests at runtime
create_request(Request, Responses) -> create_request(Request, Responses, 0).
create_request(#request{url="http://127.0.0.1:8080/1.2.1/dragoncraft/player/sanford/mission/"++OldMissionId} = Request, Responses, RequestNumber) ->
         ?DEBUG_MSG("~p Request for wall Found!~n", [?MODULE]),
         [LastResponseRecord|RestResponses] = Responses,
         {{_HttpVer, _ResponseCode, _ResponseDesc}, _Headers, ResponseBodyRaw} = LastResponseRecord#response.response_obj,
         {ok, ResponseBodyObj} = json:decode(ResponseBodyRaw),
         ResponseKVs = element(1, ResponseBodyObj),
         [Response_KV1 | [Response_KV2 | Response_KV_Rest ]] = ResponseKVs,
         Response_KV2_Key = element(1, Response_KV2),
         Response_KV2_Val = element(2, Response_KV2),
         ResponseDataObj = element(1, Response_KV2_Val),
         [ResponseDataKV | ResponseDataKVRest ] = ResponseDataObj,
         ResponseData_KV_Key = element(1, ResponseDataKV), %<<"identifier">>
         ResponseData_KV_Val = element(2, ResponseDataKV),
         MissionId = binary_to_list(ResponseData_KV_Val),
         Replaced = re:replace(Request#request.url, OldMissionId, MissionId++"/wall"),
         [ReHead|ReRest] = Replaced,
         [ReTail] = ReRest,
         ?DEBUG_MSG("~p replaced head is ~p and tail ~p ~n", [?MODULE, ReHead, ReTail]),
         NewUrl = binary_to_list(ReHead)++binary_to_list(ReTail),
         NewRequest = Request#request{url=NewUrl};
create_request(Request, Responses, RequestNumber) -> Request.
Other notables
● Recently started using python's fabric library
  for rolling releases.
● Node cluster for multiprocess node.
● Node ipc with linux signals to raise and lower
  logging levels and content updates.
Screenshots
Demo
Links
●   http://dragoncraftthegame.com/
●   http://freeverse.com/
●   http://blog.ngmoco.com/
●   https://developer.mobage.com/
●   http://dena.jp/intl/
Repos
● https://github.com/ngmoco/daida.js.git
● https://github.com/ngmoco/daida-beanstalk.
  git
● https://github.com/ngmoco/daida-local.git
● https://github.com/ngmoco/Megaphone
  (coming very soon)

More Related Content

What's hot

06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt CommunicationAndreas Jakl
 
Node.js System: The Approach
Node.js System: The ApproachNode.js System: The Approach
Node.js System: The ApproachHaci Murat Yaman
 
Grand Central Dispatch - iOS Conf SG 2015
Grand Central Dispatch - iOS Conf SG 2015Grand Central Dispatch - iOS Conf SG 2015
Grand Central Dispatch - iOS Conf SG 2015Ben Asher
 
ClojureScript interfaces to React
ClojureScript interfaces to ReactClojureScript interfaces to React
ClojureScript interfaces to ReactMichiel Borkent
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPrashant Rane
 
Node.js Explained
Node.js ExplainedNode.js Explained
Node.js ExplainedJeff Kunkle
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.jsorkaplan
 
Find bottleneck and tuning in Java Application
Find bottleneck and tuning in Java ApplicationFind bottleneck and tuning in Java Application
Find bottleneck and tuning in Java Applicationguest1f2740
 
Новый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныНовый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныTimur Safin
 
Metarhia: Node.js Macht Frei
Metarhia: Node.js Macht FreiMetarhia: Node.js Macht Frei
Metarhia: Node.js Macht FreiTimur Shemsedinov
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the wayOleg Podsechin
 
C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴명신 김
 

What's hot (20)

06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
Node.js System: The Approach
Node.js System: The ApproachNode.js System: The Approach
Node.js System: The Approach
 
Grand Central Dispatch - iOS Conf SG 2015
Grand Central Dispatch - iOS Conf SG 2015Grand Central Dispatch - iOS Conf SG 2015
Grand Central Dispatch - iOS Conf SG 2015
 
ClojureScript interfaces to React
ClojureScript interfaces to ReactClojureScript interfaces to React
ClojureScript interfaces to React
 
Pune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCDPune-Cocoa: Blocks and GCD
Pune-Cocoa: Blocks and GCD
 
Nodejs in Production
Nodejs in ProductionNodejs in Production
Nodejs in Production
 
Node.js Explained
Node.js ExplainedNode.js Explained
Node.js Explained
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
Streams in Node.js
Streams in Node.jsStreams in Node.js
Streams in Node.js
 
Find bottleneck and tuning in Java Application
Find bottleneck and tuning in Java ApplicationFind bottleneck and tuning in Java Application
Find bottleneck and tuning in Java Application
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Новый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоныНовый InterSystems: open-source, митапы, хакатоны
Новый InterSystems: open-source, митапы, хакатоны
 
Metarhia: Node.js Macht Frei
Metarhia: Node.js Macht FreiMetarhia: Node.js Macht Frei
Metarhia: Node.js Macht Frei
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 
Server side JavaScript: going all the way
Server side JavaScript: going all the wayServer side JavaScript: going all the way
Server side JavaScript: going all the way
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴C#을 이용한 task 병렬화와 비동기 패턴
C#을 이용한 task 병렬화와 비동기 패턴
 
node.js dao
node.js daonode.js dao
node.js dao
 
NodeJS: an Introduction
NodeJS: an IntroductionNodeJS: an Introduction
NodeJS: an Introduction
 
9.4json
9.4json9.4json
9.4json
 

Similar to Dragoncraft Architectural Overview

Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaKerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaSpark Summit
 
Node js
Node jsNode js
Node jshazzaz
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsManuel Eusebio de Paz Carmona
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools Yulia Shcherbachova
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in PracticeAlina Dolgikh
 
ECMAScript 6 and the Node Driver
ECMAScript 6 and the Node DriverECMAScript 6 and the Node Driver
ECMAScript 6 and the Node DriverMongoDB
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Ran Mizrahi
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang YoonJesang Yoon
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.jsYoann Gotthilf
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.ILEran Harel
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Sven Beauprez
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...bobmcwhirter
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRick Copeland
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven ProgrammingKamal Hussain
 

Similar to Dragoncraft Architectural Overview (20)

Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-MallaKerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
Kerberizing Spark: Spark Summit East talk by Abel Rincon and Jorge Lopez-Malla
 
Node js
Node jsNode js
Node js
 
Node.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first stepsNode.js Course 1 of 2 - Introduction and first steps
Node.js Course 1 of 2 - Introduction and first steps
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Declarative Infrastructure Tools
Declarative Infrastructure Tools Declarative Infrastructure Tools
Declarative Infrastructure Tools
 
Java Concurrency in Practice
Java Concurrency in PracticeJava Concurrency in Practice
Java Concurrency in Practice
 
ECMAScript 6 and the Node Driver
ECMAScript 6 and the Node DriverECMAScript 6 and the Node Driver
ECMAScript 6 and the Node Driver
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
node.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoonnode.js 실무 - node js in practice by Jesang Yoon
node.js 실무 - node js in practice by Jesang Yoon
 
Introduction to REST API with Node.js
Introduction to REST API with Node.jsIntroduction to REST API with Node.js
Introduction to REST API with Node.js
 
Node js lecture
Node js lectureNode js lecture
Node js lecture
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Ob1k presentation at Java.IL
Ob1k presentation at Java.ILOb1k presentation at Java.IL
Ob1k presentation at Java.IL
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...Flow Base Programming with Node-RED and Functional Reactive Programming with ...
Flow Base Programming with Node-RED and Functional Reactive Programming with ...
 
Event driven programming -- Node.JS
Event driven programming -- Node.JSEvent driven programming -- Node.JS
Event driven programming -- Node.JS
 
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...TorqueBox: The beauty of Ruby with the power of JBoss.  Presented at Devnexus...
TorqueBox: The beauty of Ruby with the power of JBoss. Presented at Devnexus...
 
Rapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and PythonRapid, Scalable Web Development with MongoDB, Ming, and Python
Rapid, Scalable Web Development with MongoDB, Ming, and Python
 
Server Side Event Driven Programming
Server Side Event Driven ProgrammingServer Side Event Driven Programming
Server Side Event Driven Programming
 

Recently uploaded

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 

Recently uploaded (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 

Dragoncraft Architectural Overview

  • 2.
  • 3. Jesse Sanford, Joshua Kehn Freeverse / ngmoco:) / DeNA ● Web guys brought in to design RESTful HTTP based games for handheld clients. ● Platform concurrently being built by Ngmoco team out in San Francisco. ● First games in company's history built entirely on ○ EC2 ○ Node.js ○ MongoDB ● There is a lot of firsts here!
  • 4. Why Node.js? ● Already using javascript. Knowledge share! ● Fast growing ecosystem. ● Reasonable to bring libraries from client to server and vice versa. ● Lots of javascript patterns and best practices to follow. ● Growing talent pool.
  • 5. Why MongoDB? ● Ever changing schemas make document stores attractive. ● Easy path to horizontal scalability. ● 10gen is very easy to work with. ● Lots of best practice patterns for running on ec2 infrastructure. ● Javascript is a friendly interface.
  • 6. Handling the change. ● Lots of patience. ● Many proof of concepts. ● Dedicated poc's for different puzzle pieces. (Platform services, Game Libraries) ● Developer training and evangelists. ● Performance testing and open source library vetting. ● Lots of patience. Seriously.
  • 7. Building from scratch. ● Lots of testing. ● Pre-flight environment for content. ● Duplicate of production for release staging. ● Full stack developer sandboxes on every workstation. ○ Individual MongoDB and Node.js instances running. ○ Full client stack available as a browser based handheld simulator for client interface.
  • 8. "Physical" Infrastructure ● EC2 fabric managed by Rightscale ● Extensive library of "Rightscripts" and "Server templates". ● Different deployments for each environment. ● Deployments a mix of single service machines and arrays of machines. ● Arrays load balanced by HA proxy not ELB's ● Mongo clusters are largest expense.
  • 11. Mongo Infrastructure ● Mongo cluster per environment. ● 3 config nodes split between 2 availability zones. ● Currently only 1 shard. ● 3 db nodes split between 2 availability ● mongos processes running directly on app servers.
  • 12. Mongo Infrastructure cont. ● Config nodes on t1-micros. ● DB nodes on m1-xlarges. ● DB nodes running raid 10 on ebs. ● XFS with LVM. ● Snapshots taken after forcing fsync and lock on db and then XFS freeze. ● Backups always done on secondary.
  • 13. Shrinking Mongo ● Staging and testing environments too costly. ● Logically the application knows no MongoD/S differences. ● Still single shard. ● Spinning instances is quick. ● Only used for smoke testing at the end of every dev cycle. ● Moving to single master -> slave replication. ● Cost savings of 60% in these environments.
  • 14. Other Services ● HA-proxy 2 m1-small ● Memcached - 1 m1-large ● PHP+Apache (cms), Flume/Syslog - 1 m1- large ● Ejabberd - 1 m1-large ● Beanstalkd - 1 m1-large ● Nodejs - (currently 3) c1-xlarge
  • 15. Log4js-syslog, Flume ● Centralized logging from all application servers in the cluster. ● Configurable log levels at both the application layer and filters on the stream after that. ● Flume speaks syslog fluently ● Flume allows us to point the firehose wherever we want. ● It's trivial to ingest the Flume ouput from s3 into Hadoop/Elastic Map Reduce
  • 16. Daida, Beanstalkd ● Needed fast worker queue for push messaging and out-of-band computation. ● Considered Redis and Resque ● Considered RabbitMQ/AMPQ ● Beanstalkd was built for work queues. ● Beanstalkd is very simple. ● No real support for HA ● Workers needed to be written in javascript. ● No upfront knowledge about the runtime activities of workers.
  • 17. Daida, Beanstalkd cont. ● Developers define jobs (payload contains variables needed for job to execute) ● Developers schedule jobs. ● Developers create "strategies" which know how to execute the jobs. ● At runtime using some functional magic Daida closes the developer defined strategy around the payload variables that came with the job. ● This is somewhat similar to the job being run by a worker inside a container with a
  • 18. Daida handler example. var handlers = { bar: function(data, cb) { var callback = cb || function() { /* noOp */ }; //if callback wasn't passed console.log('test job passed data: ' + JSON.stringify(data)); callback(); //always make sure to callback!!!! }, foo: function(data, cb) { var callback = cb || function() { /* noOp */ }; console.log('foo job passed name'+ data.name); callback(); //again never forget to callback!!! }, }; exports.handlers = handlers; exports.bar = handlers.bar; exports.foo = handlers.foo; //taken from https://github.com/ngmoco/daida.js
  • 19. Ejabberd ● Best multi-user-chat solution for the money. ● Considered IRC and other more custom solutions. ● Javascript handhelds can use javascript chat client libraries! ● Capable of being run over plain HTTP. (Comet/long-poll/BOSH) ● Widely used. ● Fine grained control over users and rooms. ● A little complex for our needs. ● Erlang/OTP is solid.
  • 20. Other Nodejs libraries ● Connect ● Express ● mongoose ● oauth ● connect-auth ● connect-cookie-session
  • 21. Megaphone load tester ● Written in erlang/otp to make use of it's lightweight processes and distributed nature. ● SSL Capable HTTP Reverse proxy. ● Records sessions from handhelds. ● Proxy is transparent and handhelds are stupid. ● Choose which sessions to replay. ● Write small scripts to manipulate req/resp during replay. OAuth handshakes? ● Interact with replay in console. ● Record results of replay.
  • 22. Megaphone load tester cont. ● Replay in bulk! (Load test). ● Centralized console can spawn http replay processes on many headless machines. Similar to headless Jmeter. ● A single session (some number of individual requests) is sent to the client process when spawned ● Responses are sent back to the centralized databases as clients receive them. ● The same session can be sent to multiple clients and played back concurrently.
  • 23. %% This module contains the functions to manipulate req/resp for the dcraft_session1 playback -module(dcraft_session1). EX. Session handler -include("blt_otp.hrl"). script for -export([ create_request/1, create_request/2, create_request/3]). -record(request, { url, verb, body_vars}). manipulating -record(response, {request_number, response_obj}). create_request(Request) -> create_request(Request, []). requests at runtime create_request(Request, Responses) -> create_request(Request, Responses, 0). create_request(#request{url="http://127.0.0.1:8080/1.2.1/dragoncraft/player/sanford/mission/"++OldMissionId} = Request, Responses, RequestNumber) -> ?DEBUG_MSG("~p Request for wall Found!~n", [?MODULE]), [LastResponseRecord|RestResponses] = Responses, {{_HttpVer, _ResponseCode, _ResponseDesc}, _Headers, ResponseBodyRaw} = LastResponseRecord#response.response_obj, {ok, ResponseBodyObj} = json:decode(ResponseBodyRaw), ResponseKVs = element(1, ResponseBodyObj), [Response_KV1 | [Response_KV2 | Response_KV_Rest ]] = ResponseKVs, Response_KV2_Key = element(1, Response_KV2), Response_KV2_Val = element(2, Response_KV2), ResponseDataObj = element(1, Response_KV2_Val), [ResponseDataKV | ResponseDataKVRest ] = ResponseDataObj, ResponseData_KV_Key = element(1, ResponseDataKV), %<<"identifier">> ResponseData_KV_Val = element(2, ResponseDataKV), MissionId = binary_to_list(ResponseData_KV_Val), Replaced = re:replace(Request#request.url, OldMissionId, MissionId++"/wall"), [ReHead|ReRest] = Replaced, [ReTail] = ReRest, ?DEBUG_MSG("~p replaced head is ~p and tail ~p ~n", [?MODULE, ReHead, ReTail]), NewUrl = binary_to_list(ReHead)++binary_to_list(ReTail), NewRequest = Request#request{url=NewUrl}; create_request(Request, Responses, RequestNumber) -> Request.
  • 24. Other notables ● Recently started using python's fabric library for rolling releases. ● Node cluster for multiprocess node. ● Node ipc with linux signals to raise and lower logging levels and content updates.
  • 26. Demo
  • 27. Links ● http://dragoncraftthegame.com/ ● http://freeverse.com/ ● http://blog.ngmoco.com/ ● https://developer.mobage.com/ ● http://dena.jp/intl/
  • 28. Repos ● https://github.com/ngmoco/daida.js.git ● https://github.com/ngmoco/daida-beanstalk. git ● https://github.com/ngmoco/daida-local.git ● https://github.com/ngmoco/Megaphone (coming very soon)