SlideShare a Scribd company logo
Building MapAttack: A
                          real-time geolocation
                                   game
                                Kyle Drake
Sunday, February 12, 12
geoloqi.com




                           What is Geoloqi?




geoloqi.com




 Sunday, February 12, 12
geoloqi.com




                                Real-world solutions
                          for thousands around the globe



Sunday, February 12, 12
geoloqi.com




                           Real-Time Location Tracking


                          Real-World Interactive Experiences



Sunday, February 12, 12
geoloqi.com




                          Personal Location


Sunday, February 12, 12
geoloqi.com




                          Location-Based Notes




Sunday, February 12, 12
geoloqi.com



                          YOUR GPS GETS WEIRD.




                               WE HELP FIX THAT.

Sunday, February 12, 12
geoloqi.com




                          Real-Time Applications


Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




   First Hackathon Attempt
                 Layer in Geoloqi

       Updates to MapAttack server
  via HTTP REST API

       Processing through Geoloqi’s
  persistent store

                 Finished in a weekend

                A lot of fun!
Sunday, February 12, 12
Sunday, February 12, 12
Sunday, February 12, 12
Sunday, February 12, 12
Sunday, February 12, 12
geoloqi.com




   There were some kinks
      Used an REST HTTP service for
   APNS (worked, but not “real-time”)

        Server was getting backed up
   (updates were not async)




Sunday, February 12, 12
geoloqi.com




               MapAttack Server Issues
            Blocking IO (requests to Geoloqi API held
       everything up)

                      Lots of concurrent traffic

             Events had to be broadcast to all phones/
       clients in the game synchronously




Sunday, February 12, 12
geoloqi.com




                 HOW WE
                DEALT WITH
                    IT
Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




               A key-value store, and so much more

               A great implementation of PUBLISH/SUBSCRIBE

                So simple, you can actually understand it

               Very fast and reliable

                Robust library support

Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




                 HOW WE USE NODE JS


    • Phones:
    Custom binary protocol over UDP

    • Web Browsers:
    Web Sockets via Socket.IO




Sunday, February 12, 12
geoloqi.com




                          Socket.IO is awesome
                           Adapter Pattern for realtime

                           Web Sockets, Flash, Long Polling!

                           One interface for everything

                           Easy to implement: ~100 LOC
Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




                          Geoloqi API
                ASYNC FTW!

                Delayed updates when possible

                Messages queues: Beanstalk

                Workers pick tasks off the stack

                Process data outside of the persistent store

                Simpler than AMQP

Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com



                            The Reactor Pattern
                      “The reactor design pattern is a concurrent
                       programming pattern for handling service
                      requests delivered concurrently to a service
                      handler by one or more inputs” - Wikipedia
             My simplest description: Takes your blocking IO
              operation, shoves it into its own kernel thread
            behind the scenes, uses Unix kernel magic to make
                it rejoin the reactor queue when it’s ready.
                                    Linux: epoll(4)
                                    BSD: kqueue/kevent
Sunday, February 12, 12
geoloqi.com



                          Concurrent IO is a common problem
                          All programming languages have trouble with it
                          The Reactor pattern is a tool to resolve it
                          Most languages have the Reactor pattern!

                          JavaScript              Node.js

                           Python                 Twisted

                            Ruby         EventMachine (libem, C)

                             Java              JBoss_Netty

                            PHP                  None yet
Sunday, February 12, 12
geoloqi.com



                                 MapAttack Server
                            (or: How to make Ruby ROFLscale)

                          MRI Ruby has a global interpreter lock

                          But MRI Ruby does not block on IO

                          JRuby and Rubinius 2: Native Threads

                          And it has a reactor pattern, just like Node JS



Sunday, February 12, 12
geoloqi.com




                    Sinatra::Synchrony
                             kyledrake.net/sinatra-synchrony

                          Implements EventMachine with Fibers

                          The result: NO CALLBACKS

                          < 100 LOC

                          Only coding change is to use EM libs and fibers

                          DON’T USE IT.
Sunday, February 12, 12
geoloqi.com




                    Sinatra::Synchrony




Sunday, February 12, 12
geoloqi.com




Sunday, February 12, 12
geoloqi.com




                      Let’s Talk Performance.




Sunday, February 12, 12
geoloqi.com




                          Database = your real
                          persistence problem




Sunday, February 12, 12
geoloqi.com




                      Make the relevant data
                      stay outside of the slow
                         persistence store.



Sunday, February 12, 12
geoloqi.com




    If you’re trying to solve a problem by
      ROFLscaling your persistent store,
             you’re doing it wrong.




Sunday, February 12, 12
geoloqi.com




                          Examples of doing it wrong
               “Let’s rewrite everything to use TrendDB”

                Using EC2 for a single-master DB “because it scales”

                Buying something from Oracle

     “Ruby/PHP/JS is too slow for this, let’s rewrite it in
 TrendLang”

      Many NoSQL solutions have problems you don’t
 know about. Global write locks, single write master, et
 cetera
Sunday, February 12, 12
geoloqi.com




     If you must speed up your persistent
        store, here’s my practical advice.




Sunday, February 12, 12
geoloqi.com



                          Real Hardware FTW?
                   Single master database? Get a real server! Really!

                   Cloud is only as fast as the fastest available HDD

                   EBS performance is not great, even in RAID0 stripe
    See orion.heroku.com/past/2009/7/29/io_performance_on_ebs
    and perfcap.blogspot.com/2011/03/understanding-and-using-amazon-ebs.html
    and blog.dt.org/index.php/2010/06/amazon-ec2-io-performance-local-emphemeral-disks-vs-raid0-
    striped-ebs-volumes/
    and endevver.com/2010/03/cost-analysis-of-an-amazon-ec2-deployment.html
    and mysqlperformanceblog.com/2011/02/21/death-match-ebs-versus-ssd-price-performance-and-
    qos
    and google.com/search?q=heroku+ebs+performance


                   High end Xeon, 32GB ECC, fast 220GB SSD: ~$2K
Sunday, February 12, 12
geoloqi.com



                          Real Hardware FTW?
       The paradigm is diversifying, and the reason is SSD.

       Say hello to the Fusion-io ioDrive Octal.
       PCIe x16 slot
       5.12TB
       6.0 GB/s read
       4.4 GB/s write
       1.19 MILLION IOPS

       Cost: $100,000 (plus $10 S&H).
       It’s a steal at this price.. but it will get cheaper.

Sunday, February 12, 12
geoloqi.com



                          Real Hardware FTW?
                            $500 PCIe SSD drives:
                                  220GB
                               >100,000 IOPS
                               ~700MB/s R/W

                            15,000 RPM SAS drives:
                                    2TB+
                                ~175-210 IOPS
                                <150MB/s R/W



Sunday, February 12, 12
geoloqi.com



                                     Long Term
                          Multi-master experiment (Brewer’s CAP)

                          Riak is my current favorite

                      Cloud companies providing real hardware
                 performance

                          Map/Reduce != Database




Sunday, February 12, 12
geoloqi.com




                          In Summary




Sunday, February 12, 12
geoloqi.com




            Geo-location games
                 are FUN!




Sunday, February 12, 12
geoloqi.com



            Use the Geoloqi API to make
           geolocation games! We did the
                 hard work for you.




Sunday, February 12, 12
geoloqi.com



                     MapAttack is open source!
                          github.com/geoloqi/MapAttack




Sunday, February 12, 12
geoloqi.com



                          Other uses of Geoloqi




Sunday, February 12, 12
geoloqi.com




                          Thanks!


Sunday, February 12, 12

More Related Content

What's hot

Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Baruch Sadogursky
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2
ice799
 
Ruby Proxies for Scale, Performance, and Monitoring
Ruby Proxies for Scale, Performance, and MonitoringRuby Proxies for Scale, Performance, and Monitoring
Ruby Proxies for Scale, Performance, and Monitoring
Ilya Grigorik
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
ice799
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
ice799
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
tobiascrawley
 
Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011
tobiascrawley
 
Pyramid faq
Pyramid faqPyramid faq
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Baruch Sadogursky
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chef
ice799
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
Bruno Oliveira
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
Sven Peters
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
Hiroshi SHIBATA
 
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
gwhathistory
 
Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015
Travis Reeder
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
Nick Sieger
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.js
Sergi Mansilla
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applications
Sergi Mansilla
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
mametter
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & Tricks
Steve McMahon
 

What's hot (20)

Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the Cloud as presen...
 
Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2Infrastructure as code might be literally impossible part 2
Infrastructure as code might be literally impossible part 2
 
Ruby Proxies for Scale, Performance, and Monitoring
Ruby Proxies for Scale, Performance, and MonitoringRuby Proxies for Scale, Performance, and Monitoring
Ruby Proxies for Scale, Performance, and Monitoring
 
Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015Puppet Camp LA 2/19/2015
Puppet Camp LA 2/19/2015
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
Torquebox OSCON Java 2011
Torquebox OSCON Java 2011Torquebox OSCON Java 2011
Torquebox OSCON Java 2011
 
Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011Torquebox @ Raleigh.rb - April 2011
Torquebox @ Raleigh.rb - April 2011
 
Pyramid faq
Pyramid faqPyramid faq
Pyramid faq
 
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
Building a private CI/CD pipeline with Java and Docker in the cloud as presen...
 
Chef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & ChefChef Conf 2015: Package Management & Chef
Chef Conf 2015: Package Management & Chef
 
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e RubyTorqueBox - Ultrapassando a fronteira entre Java e Ruby
TorqueBox - Ultrapassando a fronteira entre Java e Ruby
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0Gemification for Ruby 2.5/3.0
Gemification for Ruby 2.5/3.0
 
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
Lessons Learned Setting Up the OSM Stack Workshop SotM US 2013
 
Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015Go After 4 Years in Production - QCon 2015
Go After 4 Years in Production - QCon 2015
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 
Big app design for Node.js
Big app design for Node.jsBig app design for Node.js
Big app design for Node.js
 
Architecting large Node.js applications
Architecting large Node.js applicationsArchitecting large Node.js applications
Architecting large Node.js applications
 
An introduction and future of Ruby coverage library
An introduction and future of Ruby coverage libraryAn introduction and future of Ruby coverage library
An introduction and future of Ruby coverage library
 
Plone Deployment Secrets & Tricks
Plone Deployment Secrets & TricksPlone Deployment Secrets & Tricks
Plone Deployment Secrets & Tricks
 

Similar to NodePDX Slides

GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Project
roumia
 
Geobliki: A Platform For Emergency Response
Geobliki: A Platform For Emergency ResponseGeobliki: A Platform For Emergency Response
Geobliki: A Platform For Emergency Response
Pat Cappelaere
 
Building real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.jsBuilding real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.js
betabeers
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
Yohan Totting
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General Assembly
Azat Mardanov
 
HH.JS - State of the Automation
HH.JS - State of the AutomationHH.JS - State of the Automation
HH.JS - State of the Automation
Adam Christian
 
Java: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedJava: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggerated
Steve Dalton
 
Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)
packetloop
 
Building scalablewebapps
Building scalablewebappsBuilding scalablewebapps
Building scalablewebapps
Ayumu Aizawa
 
Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5
C4Media
 
Ajax for-coldfusion-developers
Ajax for-coldfusion-developersAjax for-coldfusion-developers
Ajax for-coldfusion-developers
Sudhakar Ganta
 
Building Data Driven Products With Ruby - RubyConf 2012
Building Data Driven Products With Ruby - RubyConf 2012Building Data Driven Products With Ruby - RubyConf 2012
Building Data Driven Products With Ruby - RubyConf 2012
Ryan Weald
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010
Matt Aimonetti
 
Inside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private CloudInside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private Cloud
Atlassian
 
JClouds at San Francisco Java User Group
JClouds at San Francisco Java User GroupJClouds at San Francisco Java User Group
JClouds at San Francisco Java User Group
Marakana Inc.
 
Android - CodeMiner 42 Tech Talk
Android - CodeMiner 42 Tech TalkAndroid - CodeMiner 42 Tech Talk
Android - CodeMiner 42 Tech Talk
Jonas Alves
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video delivery
Hugh Watkins
 
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at OoyalaCassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
DataStax Academy
 
Node.js, toy or power tool?
Node.js, toy or power tool?Node.js, toy or power tool?
Node.js, toy or power tool?
Ovidiu Dimulescu
 
Core Data in Motion
Core Data in MotionCore Data in Motion
Core Data in Motion
Lori Olson
 

Similar to NodePDX Slides (20)

GitHub Notable OSS Project
GitHub  Notable OSS ProjectGitHub  Notable OSS Project
GitHub Notable OSS Project
 
Geobliki: A Platform For Emergency Response
Geobliki: A Platform For Emergency ResponseGeobliki: A Platform For Emergency Response
Geobliki: A Platform For Emergency Response
 
Building real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.jsBuilding real time apps with node.js, socket.io, knockout.js
Building real time apps with node.js, socket.io, knockout.js
 
Html5 new sword for interactive app
Html5 new sword for interactive appHtml5 new sword for interactive app
Html5 new sword for interactive app
 
Intro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General AssemblyIntro to Backbone.js by Azat Mardanov for General Assembly
Intro to Backbone.js by Azat Mardanov for General Assembly
 
HH.JS - State of the Automation
HH.JS - State of the AutomationHH.JS - State of the Automation
HH.JS - State of the Automation
 
Java: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggeratedJava: Rumours of my demise are greatly exaggerated
Java: Rumours of my demise are greatly exaggerated
 
Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)Ruxcon Finding Needles in Haystacks (the size of countries)
Ruxcon Finding Needles in Haystacks (the size of countries)
 
Building scalablewebapps
Building scalablewebappsBuilding scalablewebapps
Building scalablewebapps
 
Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5Multiplatform, Promises and HTML5
Multiplatform, Promises and HTML5
 
Ajax for-coldfusion-developers
Ajax for-coldfusion-developersAjax for-coldfusion-developers
Ajax for-coldfusion-developers
 
Building Data Driven Products With Ruby - RubyConf 2012
Building Data Driven Products With Ruby - RubyConf 2012Building Data Driven Products With Ruby - RubyConf 2012
Building Data Driven Products With Ruby - RubyConf 2012
 
Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010Macruby - RubyConf Presentation 2010
Macruby - RubyConf Presentation 2010
 
Inside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private CloudInside the Atlassian OnDemand Private Cloud
Inside the Atlassian OnDemand Private Cloud
 
JClouds at San Francisco Java User Group
JClouds at San Francisco Java User GroupJClouds at San Francisco Java User Group
JClouds at San Francisco Java User Group
 
Android - CodeMiner 42 Tech Talk
Android - CodeMiner 42 Tech TalkAndroid - CodeMiner 42 Tech Talk
Android - CodeMiner 42 Tech Talk
 
Erlang for video delivery
Erlang for video deliveryErlang for video delivery
Erlang for video delivery
 
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at OoyalaCassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
Cassandra Meetup: Real-time Analytics using Cassandra, Spark and Shark at Ooyala
 
Node.js, toy or power tool?
Node.js, toy or power tool?Node.js, toy or power tool?
Node.js, toy or power tool?
 
Core Data in Motion
Core Data in MotionCore Data in Motion
Core Data in Motion
 

Recently uploaded

SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
maazsz111
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
Hiroshi SHIBATA
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
Javier Junquera
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
Intelisync
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 

Recently uploaded (20)

SAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloudSAP S/4 HANA sourcing and procurement to Public cloud
SAP S/4 HANA sourcing and procurement to Public cloud
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
Introduction of Cybersecurity with OSS at Code Europe 2024
Introduction of Cybersecurity with OSS  at Code Europe 2024Introduction of Cybersecurity with OSS  at Code Europe 2024
Introduction of Cybersecurity with OSS at Code Europe 2024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)GNSS spoofing via SDR (Criptored Talks 2024)
GNSS spoofing via SDR (Criptored Talks 2024)
 
A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024A Comprehensive Guide to DeFi Development Services in 2024
A Comprehensive Guide to DeFi Development Services in 2024
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 

NodePDX Slides

  • 1. Building MapAttack: A real-time geolocation game Kyle Drake Sunday, February 12, 12
  • 2. geoloqi.com What is Geoloqi? geoloqi.com Sunday, February 12, 12
  • 3. geoloqi.com Real-world solutions for thousands around the globe Sunday, February 12, 12
  • 4. geoloqi.com Real-Time Location Tracking Real-World Interactive Experiences Sunday, February 12, 12
  • 5. geoloqi.com Personal Location Sunday, February 12, 12
  • 6. geoloqi.com Location-Based Notes Sunday, February 12, 12
  • 7. geoloqi.com YOUR GPS GETS WEIRD. WE HELP FIX THAT. Sunday, February 12, 12
  • 8. geoloqi.com Real-Time Applications Sunday, February 12, 12
  • 10. geoloqi.com First Hackathon Attempt Layer in Geoloqi Updates to MapAttack server via HTTP REST API Processing through Geoloqi’s persistent store Finished in a weekend A lot of fun! Sunday, February 12, 12
  • 15. geoloqi.com There were some kinks Used an REST HTTP service for APNS (worked, but not “real-time”) Server was getting backed up (updates were not async) Sunday, February 12, 12
  • 16. geoloqi.com MapAttack Server Issues Blocking IO (requests to Geoloqi API held everything up) Lots of concurrent traffic Events had to be broadcast to all phones/ clients in the game synchronously Sunday, February 12, 12
  • 17. geoloqi.com HOW WE DEALT WITH IT Sunday, February 12, 12
  • 19. geoloqi.com A key-value store, and so much more A great implementation of PUBLISH/SUBSCRIBE So simple, you can actually understand it Very fast and reliable Robust library support Sunday, February 12, 12
  • 24. geoloqi.com HOW WE USE NODE JS • Phones: Custom binary protocol over UDP • Web Browsers: Web Sockets via Socket.IO Sunday, February 12, 12
  • 25. geoloqi.com Socket.IO is awesome Adapter Pattern for realtime Web Sockets, Flash, Long Polling! One interface for everything Easy to implement: ~100 LOC Sunday, February 12, 12
  • 27. geoloqi.com Geoloqi API ASYNC FTW! Delayed updates when possible Messages queues: Beanstalk Workers pick tasks off the stack Process data outside of the persistent store Simpler than AMQP Sunday, February 12, 12
  • 29. geoloqi.com The Reactor Pattern “The reactor design pattern is a concurrent programming pattern for handling service requests delivered concurrently to a service handler by one or more inputs” - Wikipedia My simplest description: Takes your blocking IO operation, shoves it into its own kernel thread behind the scenes, uses Unix kernel magic to make it rejoin the reactor queue when it’s ready. Linux: epoll(4) BSD: kqueue/kevent Sunday, February 12, 12
  • 30. geoloqi.com Concurrent IO is a common problem All programming languages have trouble with it The Reactor pattern is a tool to resolve it Most languages have the Reactor pattern! JavaScript Node.js Python Twisted Ruby EventMachine (libem, C) Java JBoss_Netty PHP None yet Sunday, February 12, 12
  • 31. geoloqi.com MapAttack Server (or: How to make Ruby ROFLscale) MRI Ruby has a global interpreter lock But MRI Ruby does not block on IO JRuby and Rubinius 2: Native Threads And it has a reactor pattern, just like Node JS Sunday, February 12, 12
  • 32. geoloqi.com Sinatra::Synchrony kyledrake.net/sinatra-synchrony Implements EventMachine with Fibers The result: NO CALLBACKS < 100 LOC Only coding change is to use EM libs and fibers DON’T USE IT. Sunday, February 12, 12
  • 33. geoloqi.com Sinatra::Synchrony Sunday, February 12, 12
  • 35. geoloqi.com Let’s Talk Performance. Sunday, February 12, 12
  • 36. geoloqi.com Database = your real persistence problem Sunday, February 12, 12
  • 37. geoloqi.com Make the relevant data stay outside of the slow persistence store. Sunday, February 12, 12
  • 38. geoloqi.com If you’re trying to solve a problem by ROFLscaling your persistent store, you’re doing it wrong. Sunday, February 12, 12
  • 39. geoloqi.com Examples of doing it wrong “Let’s rewrite everything to use TrendDB” Using EC2 for a single-master DB “because it scales” Buying something from Oracle “Ruby/PHP/JS is too slow for this, let’s rewrite it in TrendLang” Many NoSQL solutions have problems you don’t know about. Global write locks, single write master, et cetera Sunday, February 12, 12
  • 40. geoloqi.com If you must speed up your persistent store, here’s my practical advice. Sunday, February 12, 12
  • 41. geoloqi.com Real Hardware FTW? Single master database? Get a real server! Really! Cloud is only as fast as the fastest available HDD EBS performance is not great, even in RAID0 stripe See orion.heroku.com/past/2009/7/29/io_performance_on_ebs and perfcap.blogspot.com/2011/03/understanding-and-using-amazon-ebs.html and blog.dt.org/index.php/2010/06/amazon-ec2-io-performance-local-emphemeral-disks-vs-raid0- striped-ebs-volumes/ and endevver.com/2010/03/cost-analysis-of-an-amazon-ec2-deployment.html and mysqlperformanceblog.com/2011/02/21/death-match-ebs-versus-ssd-price-performance-and- qos and google.com/search?q=heroku+ebs+performance High end Xeon, 32GB ECC, fast 220GB SSD: ~$2K Sunday, February 12, 12
  • 42. geoloqi.com Real Hardware FTW? The paradigm is diversifying, and the reason is SSD. Say hello to the Fusion-io ioDrive Octal. PCIe x16 slot 5.12TB 6.0 GB/s read 4.4 GB/s write 1.19 MILLION IOPS Cost: $100,000 (plus $10 S&H). It’s a steal at this price.. but it will get cheaper. Sunday, February 12, 12
  • 43. geoloqi.com Real Hardware FTW? $500 PCIe SSD drives: 220GB >100,000 IOPS ~700MB/s R/W 15,000 RPM SAS drives: 2TB+ ~175-210 IOPS <150MB/s R/W Sunday, February 12, 12
  • 44. geoloqi.com Long Term Multi-master experiment (Brewer’s CAP) Riak is my current favorite Cloud companies providing real hardware performance Map/Reduce != Database Sunday, February 12, 12
  • 45. geoloqi.com In Summary Sunday, February 12, 12
  • 46. geoloqi.com Geo-location games are FUN! Sunday, February 12, 12
  • 47. geoloqi.com Use the Geoloqi API to make geolocation games! We did the hard work for you. Sunday, February 12, 12
  • 48. geoloqi.com MapAttack is open source! github.com/geoloqi/MapAttack Sunday, February 12, 12
  • 49. geoloqi.com Other uses of Geoloqi Sunday, February 12, 12
  • 50. geoloqi.com Thanks! Sunday, February 12, 12