1 / 66

An Erlang Game Stack

Erlang User Conference 2012 H. Diedrich. Lua + Erlang + VoltDB. An Erlang Game Stack. Henning Diedrich. Maintainer Emysql, Erlvolt, Erlualib Eonblast: game + film NewTracks: game + music Bricks and mortar Insurance tariff language. Octocat says: try markedoc!. Eonblast. This Talk.

kass
Download Presentation

An Erlang Game Stack

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Erlang User Conference 2012 H. Diedrich Lua + Erlang + VoltDB An Erlang Game Stack

  2. Henning Diedrich • Maintainer Emysql, Erlvolt, Erlualib • Eonblast: game + film • NewTracks: game + music • Bricks and mortar • Insurance tariff language Octocat says: try markedoc!

  3. Eonblast

  4. This Talk • A game server architecture • Its components • Their interfaces

  5. This Talk • Work in progress • Unproven concepts • Lies, conjecture • 3 genius tools • 10,000 lines of code

  6. Questions • Please throw them in like Torben. • Mail me at hd2010@eonblast.com. • Erlang Mailing List.

  7. Erlang Game Servers

  8. Erlang + MySQL http://eonblast.github.com/Emysql

  9. The Hurt • Leaks, Deadlocks • Bad Productivity • Game Design Language Gap • Less Features • Less Players • Lesser Product

  10. Target „The perfect game server“ (makes no sense)

  11. Generals’ Problem State

  12. Generals’ Problem State

  13. Generals’ Problem State

  14. Generals’ Problem State

  15. Generals’ Problem State

  16. Byzantine Generals State

  17. The Hunt Server Stack • Language • Database • Protocol • Game Logic

  18. Spec “Table Game” • 1 million active players • 1 million transactions per second • 1 second latency • Linear scale • 100% data integrity

  19. Client Architecture • Fat JavaScript Browser Client • COMET

  20. Language Wishlist • Robustness • Deadlock-free • Multi-core • Linear Scale er?

  21. Database CAP • Distributed • Consistent • Highly-available • Partition-tolerant All of it!

  22. Database ACID • Atomicity • Consistency • Integrity • Durability For Granted

  23. Database Double Bookkeeping • Not every game needs it • Require ACID Transactions • Neigh impossible to emulate • Impossible with BASE /Eventual Consistency

  24. Database Upcoming Blog Post • Looking at 12 databases • Riak, Cassandra, Membase, H Base, Voldemort, MySQL, MySQL Cluster, Redis, Redis Cluster, Tokyo Cabinet, Memcached, CouchDB, Couchbase, VoltDB, MongoDB • In the light of what games need • „Unbiased comparison“ • Twitter @hdiedrich

  25. Protocol Wishlist • Small footprint • Fast to encode • Human-readable

  26. Logic Wishlist • Human Readable • Stable • Fast • Concise • Small Footprint

  27. The Answers • Client • Protocol • Server • Logic • Data

  28. “Embeddable scripting language”

  29. Lua • „Lua is strange.“ • R. Virding

  30. Lua • a = “Roberto” if a ~= nil then print “Hello ” .. a .. “!” end

  31. Lua • Created 1993 • Simple, imperative syntax • Stable syntax, stable VMs • Two main VMs: ISO C, JIT • Game scripting champion • Open Source, 100% dictatorial* *benevolent, of course Site: http://www.lua.org List: lua-l@lists.lua.org

  32. Lua • Made for non-programmers - imperative syntax • Powerful for programmers - Scheme semantics • Made for DSLs - extensible semantics • Made to be extended - simple C API • Made to be embedded - small VM footprint • Now with a native Erlang VM!

  33. Lua Caveats • Deceiving Looks • Encourages magic • Simple but not for beginners • Syntax forked • Only one collection type

  34. Lua VMs • PUC Reference VM Lua 5.2 • JIT VM remains at Lua 5.1 adds extensions • Luerl Lua 5.2 incomplete pure ISO C super compatible X86, ARM, PPC, MIPS super fast native Erlang VM super stable

  35. Architecture

  36. World State State

  37. World State State State State State State State

  38. World State State State State State State State

  39. World State State State State State State State

  40. World State State State State State State State

  41. “High Velocity Database”

  42. VoltDB • Created 2009 • Simple SQL syntax • Stable 2.5 • Commercial developer, support • High Velocity Secret Tip • Open Source, 100% dictatorial* *benevolent, of course Site: http://www.volt.com

  43. VoltDB • ACID transactions – double bookkeeping • SQL – subset of '92 • Linear scale - „unlimited“ data (but ...) • Made for OLTP - fast, cheap writes, high throughput • “More SQL than SQL” – invites clean sep. of data • In-memory - 100x faster than MySQL • Replication, Snapshots – 'hot backup built in'

  44. VoltDB Caveats • Less agile than MySQL/NoSQL • Need to understand partitions • Must program SPs in Java • Not elastic (yet) • No online schema change (yet) • There is always a bottleneck • Simple but not for beginners

  45. Horizonzal Partitions State #

  46. Replication State #

  47. Actual Connections State State State State State State

  48. Fleece Erlualib Erlvolt

More Related