SlideShare a Scribd company logo
1 of 24
Lag Sucks!
Making Online Gaming Faster with NoSQL
(and without Breaking the Bank)



R.J. Lorimer
Director of Platform Engineering
Electrotank, Inc.
Robert Greene
Vice President of Technology
Versant Corporation
Electrotank, Inc.
                                   Scalable Socket Server
                                   Tested to 330,000 Users
                                   on a Single Server




  Text
MMO Game Platform
Rapid Development APIs
Avatars, Questing, Achievements,
Inventory, etc.

Mattel, Ubisoft, FunGoPlay
Modeling Worlds
●Diverse maps
●Clusters of activity
●Observing and interacting with:
 ● Other   players
 ● NPCs
 ● World   items
●All   data-driven
Modeling Worlds




  Discrete Maps are “Spaces”
Modeling Worlds




Spaces are sliced into “Regions”
Modeling Worlds




Space can be cloned into “Layers”
Modeling Worlds
●Spaces     may be very big
●Player’s   view is very small: “Awareness Bubble”
●Players can see local region objects, and also
local players
●Region data is local to the region; player data is
local to the player
●Locality   is key
Deployment Tiers
•   Players connect to ElectroServer
•   ElectroServer provides stateful
    connections and protocol
•   Player data channeled to
    correct EUP simulator node
•   EUP nodes run game logic and
    persist data
•   Game logic: spatial awareness, movement, collision
    detection, quest evaluation, item/inventory management,
    etc.
•   Storage cluster provides persistence. Data roughly divided
    as game content and player data
•   Ideally each tier independently scalable
How Do We Scale It?
• Regions hosted on servers
• Player’s primary server defined by region
• Related players grouped on same box (mostly)
• Avoids having to cluster heavy simulations
• Much more efficient
• Much easier to program
• Distributes server load automatically
• Regions share data via point-to-point channels
• Players transition through channels
The Storage Cluster
●Latency   is key
●Lots of relationship fetching
●Lots of little records
●Heavy contention on some data
●Very little “ad-hoc”/complex
 querying
Problems with RDB
●SQL  is slow
●No optimized cases

●Impedance mismatch - Hide with ORM
●ORMs are complex; brittle

●Heavy dependency on cache

●If cache isn’t warm, you’re gonna have
 a bad time
●DB cache is dumb
More Servers, More Problems
●Now  the cache crutch won’t
 support our weight
●Either:
 ● Tons  of sync data sent from server to
   server or...
 ● Cache is evicted constantly making it
   ineffective
●Keep     hitting that latency wall
So What Then? NoSQL
• If RDB doesn’t work, try something else!
• Lots of options
• Tailored to solving specific problems
• Many different styles to consider
• Often not atomic: Easy to scale; harder to
  code.
• Variable standards/spec support
• Young technologies means rough edges
• What they are good at may not be what we
  need
NoSQL Options
➡ Key-Value
● Good:   Optimized Cases, Simple, Easy to
 Scale
● Bad: Atomicity, Simple, but still
 impedance mismatch. Querying can be
 hard.
➡ Document-Oriented
● Good:
      Simple Communication (HTTP
 +REST), Scaling can be easy.
● Bad:  No schema means embedded
 schema. Protocol is expensive. Impedance
 still high (we’re not storing documents).
 Querying can be very hard.
NoSQL Options
➡ Graph Databases
●Good: Conceptually similar to objects, Atomic.
●Bad: Impedance is still high: nodes and edges vs.
 objects and relationships. Mentally complex, and
 can be hard to analyze outside of code.




Not ideally suited to this problem. Might be a great
backend for something like an NPC steering engine.
Object Databases
●Inherently understand OO (inheritance,
 polymorphism, relationships)
●No impedance mismatch. Objects are the
 schema. Code and data match
●Atomic. Transparent scaling may be expensive.
 Managed scaling may not be
●More mature
●Good spec support (JPA)
No More Impedance
• EUP is heavy on the "O" in ORM already
• Most common use-case:
  Fetching relationships; "walking the graph"
 • RDB: Intermediate layers on fetch: SQL, JDBC, result-sets,
   and foreign keys. No context. Over-fetching.
 • ODB: Understands object graph natively. Only sends what
   it needs, in the format it needs. Relationships can be
   primed for subsequent retrieval.
• Less reliance on second-level cache => easier to
  cluster.
Less Code
@Entity                                           @Entity
@Table("player")                                  public class Player extends AbstractEntity {
@Inheritance(strategy = InheritanceType.JOINED)       @Basic(optional=false)
public class Player extends AbstractEntity {          private String name;
    @Column(unique = true, nullable = false,
length = 50, name = "characterName")                  @ManyToOne(
    private String name;                              optional = false, fetch = FetchType.LAZY)
                                                      private AccountType type;
    @ManyToOne(
     optional = false, fetch = FetchType.LAZY)        @ManyToMany
    @JoinColumn(name = "accountTypeId")               private Set<Relationship> friends;
    private AccountType type;                         // ...
                                                  }

    @ManyToMany(mappedBy = "player")
                                                  Same Annotations; Same Concepts
    private Set<Relationship> friends;
                                                   • Simple Migration of application code
    // ...
                                                   • Easy to understand for the JPA familiar
}
                                                  No "Schema Helpers" Required
                                                   • Data model matches 1-1 with object
                                                   • No confusing "who owns who" questions
                                                   • Column names in code feels dirty
Performance

                                       Object DBs
                                       are Fast.




 Very, Very Fast.
http://polepos.sourceforge.net
"The open source database benchmark"

http://www.jpab.org
"The JPA Benchmark"
Versant Features
• LOIDs for global identity
• Sharded querying
• Selective storage (Object X goes in DB Y)
  Object x = /*..*/; Database y = /* .. */;
  em.persist(y, x);

• Transparent, networked object graphs
  (X references Y on different nodes)
• Moving content between nodes via API
  Object objToMove = em1.get(...);
  Database target = /*.. lookup appropriate node ..*/
  em2.merge(target, objToMove, MergeMode.ON_CREATE_PRESERVE_LOID);
  em1.delete(objToMove); /*.. remove from old DB ..*/
A Few More
• Schema migration is built-in, intuitive.
• Data evolution in code:
  @com.electrotank.eup.MarkedForDeletion
  private String oldField;
  @PostLoad
  void onLoad() {
    if(oldField != null) { /* migrate and set null */ }
  }


• Data migration as a feature
  Object content = /* the content to migrate */;
  Database nextDb = /* the next DB in the server tiers */
  em.merge(nextDb,content,MergeMode.ON_CREATE_PRESERVE_LOID);
Putting it All Together
             Game/Player Data
             • Player Data (e.g. Inventory) resides on
               node for player
             • Per-Instance data (e.g. World Items)
               resides on node as well
             • Player moves worlds, changing nodes.
               Takes their data with them.




             Game Content Experience
             • Content Updates in test environment
             • Update records in Static Content node(s)
             • Player data sees update immediately



             * Not necessarily 1-1 EUP to DB
Why This Matters?
• Multiple game nodes allow for true horizontal
  scalability
• With RDBs, multiple DB nodes is usually
  impractical (read: very hard). Becomes
  bottleneck and single point of failure
 (This is an oft-accepted limitation in clustered apps, however)

• Object DBs allow data/DB-traffic balancing
  along with player simulation balancing
• Per-game configurable scaling model
Questions?
  Thank You! Questions?
R.J. Lorimer - Electrotank, Inc.
E-mail:     rjlorimer@electrotank.com
LinkedIn: http://www.linkedin.com/in/rjlorimer
Twitter:    @realjenius
Company: http://www.electrotank.com
Personal:   http://www.realjenius.com



Robert Greene - Versant Corporation
E-mail:     rgreene@versant.com

More Related Content

What's hot

Blending MongoDB and RDBMS for ecommerce
Blending MongoDB and RDBMS for ecommerceBlending MongoDB and RDBMS for ecommerce
Blending MongoDB and RDBMS for ecommerceSteven Francia
 
Neo4j Training Cypher
Neo4j Training CypherNeo4j Training Cypher
Neo4j Training CypherMax De Marzi
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...Lucidworks
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disquszeeg
 
What's brewing in the eZ Systems extensions kitchen
What's brewing in the eZ Systems extensions kitchenWhat's brewing in the eZ Systems extensions kitchen
What's brewing in the eZ Systems extensions kitchenPaul Borgermans
 

What's hot (7)

ETL into Neo4j
ETL into Neo4jETL into Neo4j
ETL into Neo4j
 
Blending MongoDB and RDBMS for ecommerce
Blending MongoDB and RDBMS for ecommerceBlending MongoDB and RDBMS for ecommerce
Blending MongoDB and RDBMS for ecommerce
 
Neo4j Training Cypher
Neo4j Training CypherNeo4j Training Cypher
Neo4j Training Cypher
 
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
The Intersection of Robotics, Search and AI with Solr, MyRobotLab, and Deep L...
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disqus
 
Hibernate 3
Hibernate 3Hibernate 3
Hibernate 3
 
What's brewing in the eZ Systems extensions kitchen
What's brewing in the eZ Systems extensions kitchenWhat's brewing in the eZ Systems extensions kitchen
What's brewing in the eZ Systems extensions kitchen
 

Similar to Lag Sucks! GDC 2012

VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012Eonblast
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseAndreas Jung
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleChristophe Grand
 
JSON as a SQL Datatype
JSON as a SQL DatatypeJSON as a SQL Datatype
JSON as a SQL DatatypeRobert Sell
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the CloudTony Tam
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the Worldjhugg
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDBMongoDB
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMPT.JUG
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to CassandraJon Haddad
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine ArchitectureShawn Presser
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInLinkedIn
 
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...Amazon Web Services
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonIgor Anishchenko
 
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBase
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBaseHBaseCon 2015 General Session: Zen - A Graph Data Model on HBase
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBaseHBaseCon
 
2011 mongo sf-scaling
2011 mongo sf-scaling2011 mongo sf-scaling
2011 mongo sf-scalingMongoDB
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQLTony Tam
 
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft..."Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...Dataconomy Media
 

Similar to Lag Sucks! GDC 2012 (20)

How to choose a database
How to choose a databaseHow to choose a database
How to choose a database
 
VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012VoltDB and Erlang - Tech planet 2012
VoltDB and Erlang - Tech planet 2012
 
Why we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL DatabaseWhy we love ArangoDB. The hunt for the right NosQL Database
Why we love ArangoDB. The hunt for the right NosQL Database
 
FP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit HoleFP Days: Down the Clojure Rabbit Hole
FP Days: Down the Clojure Rabbit Hole
 
JSON as a SQL Datatype
JSON as a SQL DatatypeJSON as a SQL Datatype
JSON as a SQL Datatype
 
Running MongoDB in the Cloud
Running MongoDB in the CloudRunning MongoDB in the Cloud
Running MongoDB in the Cloud
 
Building a Database for the End of the World
Building a Database for the End of the WorldBuilding a Database for the End of the World
Building a Database for the End of the World
 
Scaling with MongoDB
Scaling with MongoDBScaling with MongoDB
Scaling with MongoDB
 
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGMUsing JPA applications in the era of NoSQL: Introducing Hibernate OGM
Using JPA applications in the era of NoSQL: Introducing Hibernate OGM
 
Hpts 2011 flexible_oltp
Hpts 2011 flexible_oltpHpts 2011 flexible_oltp
Hpts 2011 flexible_oltp
 
Intro to Cassandra
Intro to CassandraIntro to Cassandra
Intro to Cassandra
 
Game object models - Game Engine Architecture
Game object models - Game Engine ArchitectureGame object models - Game Engine Architecture
Game object models - Game Engine Architecture
 
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedInJay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
Jay Kreps on Project Voldemort Scaling Simple Storage At LinkedIn
 
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
AWS re:Invent 2016| GAM302 | Sony PlayStation: Breaking the Bandwidth Barrier...
 
Thrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased ComparisonThrift vs Protocol Buffers vs Avro - Biased Comparison
Thrift vs Protocol Buffers vs Avro - Biased Comparison
 
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBase
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBaseHBaseCon 2015 General Session: Zen - A Graph Data Model on HBase
HBaseCon 2015 General Session: Zen - A Graph Data Model on HBase
 
Voldemort Nosql
Voldemort NosqlVoldemort Nosql
Voldemort Nosql
 
2011 mongo sf-scaling
2011 mongo sf-scaling2011 mongo sf-scaling
2011 mongo sf-scaling
 
Data Modeling for NoSQL
Data Modeling for NoSQLData Modeling for NoSQL
Data Modeling for NoSQL
 
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft..."Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
"Source Code Abstracts Classification Using CNN", Vadim Markovtsev, Lead Soft...
 

Recently uploaded

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 

Recently uploaded (20)

FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 

Lag Sucks! GDC 2012

  • 1. Lag Sucks! Making Online Gaming Faster with NoSQL (and without Breaking the Bank) R.J. Lorimer Director of Platform Engineering Electrotank, Inc. Robert Greene Vice President of Technology Versant Corporation
  • 2. Electrotank, Inc. Scalable Socket Server Tested to 330,000 Users on a Single Server Text MMO Game Platform Rapid Development APIs Avatars, Questing, Achievements, Inventory, etc. Mattel, Ubisoft, FunGoPlay
  • 3. Modeling Worlds ●Diverse maps ●Clusters of activity ●Observing and interacting with: ● Other players ● NPCs ● World items ●All data-driven
  • 4. Modeling Worlds Discrete Maps are “Spaces”
  • 5. Modeling Worlds Spaces are sliced into “Regions”
  • 6. Modeling Worlds Space can be cloned into “Layers”
  • 7. Modeling Worlds ●Spaces may be very big ●Player’s view is very small: “Awareness Bubble” ●Players can see local region objects, and also local players ●Region data is local to the region; player data is local to the player ●Locality is key
  • 8. Deployment Tiers • Players connect to ElectroServer • ElectroServer provides stateful connections and protocol • Player data channeled to correct EUP simulator node • EUP nodes run game logic and persist data • Game logic: spatial awareness, movement, collision detection, quest evaluation, item/inventory management, etc. • Storage cluster provides persistence. Data roughly divided as game content and player data • Ideally each tier independently scalable
  • 9. How Do We Scale It? • Regions hosted on servers • Player’s primary server defined by region • Related players grouped on same box (mostly) • Avoids having to cluster heavy simulations • Much more efficient • Much easier to program • Distributes server load automatically • Regions share data via point-to-point channels • Players transition through channels
  • 10. The Storage Cluster ●Latency is key ●Lots of relationship fetching ●Lots of little records ●Heavy contention on some data ●Very little “ad-hoc”/complex querying
  • 11. Problems with RDB ●SQL is slow ●No optimized cases ●Impedance mismatch - Hide with ORM ●ORMs are complex; brittle ●Heavy dependency on cache ●If cache isn’t warm, you’re gonna have a bad time ●DB cache is dumb
  • 12. More Servers, More Problems ●Now the cache crutch won’t support our weight ●Either: ● Tons of sync data sent from server to server or... ● Cache is evicted constantly making it ineffective ●Keep hitting that latency wall
  • 13. So What Then? NoSQL • If RDB doesn’t work, try something else! • Lots of options • Tailored to solving specific problems • Many different styles to consider • Often not atomic: Easy to scale; harder to code. • Variable standards/spec support • Young technologies means rough edges • What they are good at may not be what we need
  • 14. NoSQL Options ➡ Key-Value ● Good: Optimized Cases, Simple, Easy to Scale ● Bad: Atomicity, Simple, but still impedance mismatch. Querying can be hard. ➡ Document-Oriented ● Good: Simple Communication (HTTP +REST), Scaling can be easy. ● Bad: No schema means embedded schema. Protocol is expensive. Impedance still high (we’re not storing documents). Querying can be very hard.
  • 15. NoSQL Options ➡ Graph Databases ●Good: Conceptually similar to objects, Atomic. ●Bad: Impedance is still high: nodes and edges vs. objects and relationships. Mentally complex, and can be hard to analyze outside of code. Not ideally suited to this problem. Might be a great backend for something like an NPC steering engine.
  • 16. Object Databases ●Inherently understand OO (inheritance, polymorphism, relationships) ●No impedance mismatch. Objects are the schema. Code and data match ●Atomic. Transparent scaling may be expensive. Managed scaling may not be ●More mature ●Good spec support (JPA)
  • 17. No More Impedance • EUP is heavy on the "O" in ORM already • Most common use-case: Fetching relationships; "walking the graph" • RDB: Intermediate layers on fetch: SQL, JDBC, result-sets, and foreign keys. No context. Over-fetching. • ODB: Understands object graph natively. Only sends what it needs, in the format it needs. Relationships can be primed for subsequent retrieval. • Less reliance on second-level cache => easier to cluster.
  • 18. Less Code @Entity @Entity @Table("player") public class Player extends AbstractEntity { @Inheritance(strategy = InheritanceType.JOINED) @Basic(optional=false) public class Player extends AbstractEntity { private String name; @Column(unique = true, nullable = false, length = 50, name = "characterName") @ManyToOne( private String name; optional = false, fetch = FetchType.LAZY) private AccountType type; @ManyToOne( optional = false, fetch = FetchType.LAZY) @ManyToMany @JoinColumn(name = "accountTypeId") private Set<Relationship> friends; private AccountType type; // ... } @ManyToMany(mappedBy = "player") Same Annotations; Same Concepts private Set<Relationship> friends; • Simple Migration of application code // ... • Easy to understand for the JPA familiar } No "Schema Helpers" Required • Data model matches 1-1 with object • No confusing "who owns who" questions • Column names in code feels dirty
  • 19. Performance Object DBs are Fast. Very, Very Fast. http://polepos.sourceforge.net "The open source database benchmark" http://www.jpab.org "The JPA Benchmark"
  • 20. Versant Features • LOIDs for global identity • Sharded querying • Selective storage (Object X goes in DB Y) Object x = /*..*/; Database y = /* .. */; em.persist(y, x); • Transparent, networked object graphs (X references Y on different nodes) • Moving content between nodes via API Object objToMove = em1.get(...); Database target = /*.. lookup appropriate node ..*/ em2.merge(target, objToMove, MergeMode.ON_CREATE_PRESERVE_LOID); em1.delete(objToMove); /*.. remove from old DB ..*/
  • 21. A Few More • Schema migration is built-in, intuitive. • Data evolution in code: @com.electrotank.eup.MarkedForDeletion private String oldField; @PostLoad void onLoad() { if(oldField != null) { /* migrate and set null */ } } • Data migration as a feature Object content = /* the content to migrate */; Database nextDb = /* the next DB in the server tiers */ em.merge(nextDb,content,MergeMode.ON_CREATE_PRESERVE_LOID);
  • 22. Putting it All Together Game/Player Data • Player Data (e.g. Inventory) resides on node for player • Per-Instance data (e.g. World Items) resides on node as well • Player moves worlds, changing nodes. Takes their data with them. Game Content Experience • Content Updates in test environment • Update records in Static Content node(s) • Player data sees update immediately * Not necessarily 1-1 EUP to DB
  • 23. Why This Matters? • Multiple game nodes allow for true horizontal scalability • With RDBs, multiple DB nodes is usually impractical (read: very hard). Becomes bottleneck and single point of failure (This is an oft-accepted limitation in clustered apps, however) • Object DBs allow data/DB-traffic balancing along with player simulation balancing • Per-game configurable scaling model
  • 24. Questions? Thank You! Questions? R.J. Lorimer - Electrotank, Inc. E-mail: rjlorimer@electrotank.com LinkedIn: http://www.linkedin.com/in/rjlorimer Twitter: @realjenius Company: http://www.electrotank.com Personal: http://www.realjenius.com Robert Greene - Versant Corporation E-mail: rgreene@versant.com

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n