{"id":1714,"date":"2018-12-06T18:03:00","date_gmt":"2018-12-06T18:03:00","guid":{"rendered":"https:\/\/gosqeng.test\/?p=1714"},"modified":"2019-11-28T10:54:58","modified_gmt":"2019-11-28T10:54:58","slug":"building-the-deepracer-leaderboard","status":"publish","type":"post","link":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard","title":{"rendered":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable."},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/leaderboards_01@2x.jpg\" width=\"1400\" height=\"900\" alt=\"leaderboard at aws re:Invent\" class=\"alignnone size-medium\" \/><\/p>\n<p>Last week, Amazon Web Services <a href=\"https:\/\/www.youtube.com\/watch?v=dwUJVYEhxGM\" rel=\"noopener noreferrer\" target=\"_blank\">announced<\/a> their latest hardware device aimed at Machine Learning education: the <a href=\"https:\/\/aws.amazon.com\/deepracer\/league\/\" rel=\"noopener noreferrer\" target=\"_blank\">DeepRacer<\/a>, an autonomous model car, with an accompanying simulator environment and Reinforcement Learning toolkit.<\/p>\n<p>Also launched at re:Invent was the official <a href=\"https:\/\/aws.amazon.com\/deepracer\/league\/\" rel=\"noopener noreferrer\" target=\"_blank\">AWS DeepRacer League<\/a>, a racing league for developers to compete with their DeepRacer models for the DeepRacer cup. The league takes place throughout 2019, but for 2018 the league took place over 48 hours during the conference.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/leaderboards_04@2x.jpg\" width=\"1400\" height=\"900\" alt=\"the AWS DeepRacer cards at AWS re:Invent\" class=\"alignnone size-medium\" \/><\/p>\n<p>All while the racing was taking place at the MGM Grand Garden Arena, racers&#8217; times were being recorded, tallied, and displayed throughout the conference, with the winners competing in the <a href=\"https:\/\/www.youtube.com\/watch?v=swusfj91Kis\" rel=\"noopener noreferrer\" target=\"_blank\">Cup Final<\/a> before Werner&#8217;s keynote.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/leaderboards_02@2x.jpg\" width=\"1400\" height=\"900\" alt=\"the DeepRacer leaderboard on the wall at AWS re:Invent\" class=\"alignnone size-medium\" \/><\/p>\n<p>AWS tasked us with building a leaderboard for recording all the race times set by competitors through the conference and displaying the leading entries in real-time on screens all through the venue, along with a mobile interface on which competitors could see the leaderboard and search for their own time.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/leaderboards_03@2x.jpg\" width=\"1400\" height=\"900\" alt=\"people watching the DeepRacer competition \" class=\"alignnone size-medium\" \/><\/p>\n<p>We took all our prior knowledge of running real-time systems in the cloud and decided to build the whole system for the web, making use of AWS systems and services wherever possible. <\/p>\n<h2>Here&#8217;s how we did it.<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/leaderboards_05@2x.jpg\" width=\"2000\" height=\"1400\" alt=\"diagram of how we built the real-time AWS DeepRacer leaderboard\" class=\"alignnone size-medium\" \/><\/p>\n<p>The core of the system is very simple: the main data-store is an <a href=\"https:\/\/aws.amazon.com\/rds\/aurora\/\" rel=\"noopener noreferrer\" target=\"_blank\">Aurora<\/a> MySQL database, containing records of competitors and their racing times, which is updated via a <a href=\"https:\/\/aws.amazon.com\/lambda\/\" rel=\"noopener noreferrer\" target=\"_blank\">Lambda<\/a> function invoked through <a href=\"https:\/\/aws.amazon.com\/api-gateway\/\" rel=\"noopener noreferrer\" target=\"_blank\">API Gateway<\/a>. All the leaderboard screens throughout the venue connect to <a href=\"https:\/\/aws.amazon.com\/iot-core\/\" rel=\"noopener noreferrer\" target=\"_blank\">AWS IoT Core<\/a> via MQTT-over-WebSockets and listen for updates on the &#8220;leaderboard&#8221; Thing. When a new time is recorded, the Lambda queries the latest set of top times and publishes it to the Thing Shadow, which is pushed out to all connected clients in real-time. Then there&#8217;s another Lambda function (again behind API Gateway) which can be called by the mobile UI for users searching for their own entries.<\/p>\n<p>The front-end of the Leaderboard is a simple React application &#8211; when a new set of state data is pushed to the Thing Shadow, it&#8217;s received over the WebSocket and the React tree is re-rendered.<\/p>\n<h2>Fully Elastic<\/h2>\n<p>When building the leaderboard it was important to make sure that whatever we built would be able to meet demand. Predicting that demand was somewhat tricky &#8211; we knew that there would be a very small number of people using the timekeeping interface to submit new entries; we knew roughly how many times the main leaderboard UI would be shown on screens at the conference, but we had very little idea how many people would be using the mobile interface. All we knew was that at some point during the conference, the main re:Invent app would be updated to show a prominent link to all attendees.<\/p>\n<p>That meant we had to be able to scale anywhere up to about 50,000 people using the mobile interface at any one moment. In reality it didn\u2019t reach quite those numbers, but we knew we needed to be able to handle a large spike in traffic at very little notice.<\/p>\n<p>In true spirit of the AWS cloud, we use as many AWS services as possible to ensure we wouldn\u2019t have to worry about scaling issues in most places. API Gateway, IoT and Lambda can scale pretty much infinitely with no special intervention or auto-scaling without breaking a sweat. The only part of our system that would need to scale is the database, living on Aurora.<\/p>\n<p>For various reasons we weren\u2019t able to use Aurora Serverless (see below), but since we only needed to scale reads from the database, it was a simple matter of making sure we had a strategy for scaling Read Nodes in the Aurora cluster should the need arise. We could have added an Auto Scaling config to add Read Nodes automatically, but for simplicity we decided to keep the process manual &#8211; we were on-site and monitoring graphs all the time anyway, and if load was looking too high we could easily throw more Read Nodes into the cluster until it was happy again.<\/p>\n<p>As it happens, we needn\u2019t have worried about scaling the database &#8211; even on a tiny RDS instance, CPU load barely registered above 10% even at peak load. And all the other parts of the infrastructure scaled completely invisibly without our intervention.<\/p>\n<h2>Lambda, Lambda everywhere<\/h2>\n<p>The leaderboards themselves fetch all their data from the leaderboard Thing via AWS IoT. For all the other data fetching (e.g. in the mobile app where you can see more than the top 20, or filter results by a search query), submission of new entries, and general administration, the manipulation is done via Lambda functions invoked via API Gateway.<\/p>\n<p>There are three Lambda functions in the backend:<\/p>\n<h3>The &#8220;fetch entries&#8221; function<\/h3>\n<p>This function is called by the mobile UI, which needs to send a query to filter the returned results. This function queries the MySQL database to fetch the results requested<\/p>\n<h3>The &#8220;submit new entry&#8221; function<\/h3>\n<p>This function is called by the timekeeping UI when submitting a new entry time. It inserts the details for the competitor as well as their race time, then fetches the current state of the top 20 entries, and publishes that updates to the Leaderboard Thing Shadow<\/p>\n<h3>The &#8220;admin&#8221; function<\/h3>\n<p>This function serves several different API endpoints used by the AWS team in charge of the league. It can edit the time for an entry already submitted, remove an entry that should be disqualified, and fetch more details on the competitors such as contact details.<\/p>\n<p>These three Lambda functions are all built using <code>aws-serverless-express<\/code>, a fantastic node module which makes it incredibly easy to build APIs on Lambda and API Gateway using the <code>express<\/code> framework, which in turn makes it easy to serve several different API endpoints from the same Lambda function without creating a function for each (e.g. the &#8220;admin&#8221; function serves <code>\/admin\/recentEntries<\/code> as well as <code>\/admin\/topEntries<\/code>)<\/p>\n<p>Since all these Lambda functions serve different purposes and deal with different levels of data sensitivity, we needed to set up some kind of permission system to ensure people couldn&#8217;t mess around with it.<\/p>\n<h2>Security and authentication<\/h2>\n<p>A racing leaderboard wouldn&#8217;t be very good if anybody could just find the URL for the time-entry page and submit their own times to put themselves at the top of the rankings. To protect against this, we set up a <a href=\"https:\/\/aws.amazon.com\/cognito\/\" rel=\"noopener noreferrer\" target=\"_blank\">Cognito<\/a> User Pool and Identity Pool, which gives us a user\/password system, and allows us to specify an <a href=\"https:\/\/aws.amazon.com\/iam\/\" rel=\"noopener noreferrer\" target=\"_blank\">IAM<\/a> Role to assume when a user logs into the time-entry page. Then, we used IAM authentication and permissions on the &#8220;submit new entry&#8221; route in API Gateway to make sure it could only be called using that particular IAM role.<\/p>\n<p>Since the race officials needed to be able to contact the winning entrants to recall them for the Cup Final, the time submission page also stores a phone number and email address for all competitors. This is sensitive personal information, so we needed to ensure that nobody had access to this except the AWS team in charge of the race &#8211; not even the officials operating the timekeeping system at the stadium. To ensure this, we added another IAM Role, which could only be assumed by the <code>admin<\/code> user in our Cognito User Pool. This role then has permission to invoke a separate admin endpoint in the API Gateway which returns this more sensitive data.<\/p>\n<p>So, all told, we have three IAM roles &#8211; a default, unauthenticated role, which is used by the leaderboards themselves and the mobile app for reading the current state of entrants and subscribing to updates via IoT; a basic authenticated role used by the timekeepers to submit new entries; and an admin role which can access the most sensitive data, and also submit after-the-fact edits to already-submitted race times.<\/p>\n<p>Each of the three Lambda functions detailed above also runs with a separate Execution Role and MySQL user, which dictates exactly what it&#8217;s allowed to access. This means that (in theory) if there was any sort of exploitable software vulnerability in our Lambda code, a bad actor wouldn&#8217;t be able to access any more data or perform any more actions than they already have access to (for example, the &#8220;fetch&#8221; Lambda cannot publish to IoT; it uses MySQL credentials which give it read-only access to the data, and only those columns which are available for public consumption)<\/p>\n<h2>Putting it all together<\/h2>\n<p>The whole Leaderboard backend is defined in a single CloudFormation template. This makes it super-easy for us to keep track of changes, deploy multiple versions (for <a href=\"https:\/\/youtu.be\/bhHT25G5YYk?t=32\" rel=\"noopener noreferrer\" target=\"_blank\">dev and test<\/a>), and to quickly deploy in new regions (we&#8217;re based in London so we did all of our original development in the eu-west-2 London region, but for production we span up a new stack in us-west-2 Oregon to be geographically closer to the venue in Las Vegas). It also meant that whenever we ran into troubles or something we didn&#8217;t expect (more on that below), we didn&#8217;t have to remember all the steps we took to figure it out once we wanted to deploy new versions &#8211; it was all right there in the template code.<\/p>\n<h2>Teething troubles<\/h2>\n<p>I won&#8217;t pretend that the development process was easy from beginning to end and went without a hitch, because that wouldn&#8217;t be true. There are plenty of quirks and things you might not expect when building things on AWS, especially when you&#8217;re trying to hook together several different services and moving parts. Here&#8217;s just a few, and the steps we had to take to solve them:<\/p>\n<ul>\n<li>When connecting to the IoT Device Gateway, you use an account-specific endpoint, which looks something like <code>a1234567890abc.iot.us-west-2.amazonaws.com<\/code>. For compatibility and legacy reasons, this endpoint uses an SSL certificate that&#8217;s no longer trusted by most major browsers, so requests it to simply fail with a security error. There is a separate endpoint, formatted the same, but with <code>-ats<\/code> before the <code>.iot.<\/code>, which is signed by the Amazon Trust Store, but this isn&#8217;t the default endpoint returned by IoT&#8217;s <a href=\"https:\/\/docs.aws.amazon.com\/iot\/latest\/apireference\/API_DescribeEndpoint.html\" rel=\"noopener noreferrer\" target=\"_blank\">DescribeEndpoint API<\/a>. You need to use the <code>endpointType=iot:Data-ATS<\/code> parameter to request this up-to-date endpoint, or remember to substitute in the <code>-ats<\/code> if you want anything to work in modern browsers<\/li>\n<li>In order to lock down access to our Aurora database, we gave it a VPC security group and locked down port 3306. However, in order to grant access only to our Lambda functions, that meant we had to run the functions inside our VPC, which means that they have very long cold-start times. In addition, in order to access the IoT endpoint, those functions needed to have access to the public internet, which meant we had to add a NAT Gateway (and corresponding route tables) into our VPC<\/li>\n<li>Since our setup scripts needed to be able to query the Aurora database and set up the schema with all the correct tables and columns, we needed the database to be accessible from the public internet. We could have spun up an EC2 instance or a Lambda function to run queries directly from within our VPC but we decided that added unnecessary complication for this project. What it did mean, however, was that we weren&#8217;t able to use <a href=\"https:\/\/aws.amazon.com\/rds\/aurora\/serverless\/\" rel=\"noopener noreferrer\" target=\"_blank\">Aurora Serverless<\/a>, since it&#8217;s not possible to set up with public internet access. Today we would be able to solve this with the new <a href=\"https:\/\/aws.amazon.com\/about-aws\/whats-new\/2018\/11\/aurora-serverless-data-api-beta\/\" rel=\"noopener noreferrer\" target=\"_blank\">Aurora Serverless Data API<\/a>, but this wasn&#8217;t available when we started building the backend.<\/li>\n<\/ul>\n<p>If you want to learn more about <a href=\"https:\/\/www.gosquared.com\" rel=\"noopener noreferrer\" target=\"_blank\">GoSquared<\/a> you can take a look at <a href=\"https:\/\/www.gosquared.com\/blog\" rel=\"noopener noreferrer\" target=\"_blank\">our other blog posts<\/a>, <a href=\"https:\/\/aws.amazon.com\/marketplace\/pp\/B076H9ZGDR?qid=1544117002100&#038;sr=0-1&#038;ref_=srh_res_product_title\" rel=\"noopener noreferrer\" target=\"_blank\">find us on AWS Marketplace<\/a> or check out <a href=\"https:\/\/twitter.com\/GoSquared\" rel=\"noopener noreferrer\" target=\"_blank\">our twitter<\/a>. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last week, Amazon Web Services announced their latest hardware device aimed at Machine Learning education: the DeepRacer, an autonomous model&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1452],"tags":[119,750,997],"class_list":["post-1714","post","type-post","status-publish","format-standard","hentry","category-engineering","tag-aws","tag-real-time","tag-reinvent"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v18.6 (Yoast SEO v19.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable. - GoSquared Blog<\/title>\n<meta name=\"description\" content=\"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable.\" \/>\n<meta property=\"og:description\" content=\"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard\" \/>\n<meta property=\"og:site_name\" content=\"GoSquared Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/GoSquared\" \/>\n<meta property=\"article:published_time\" content=\"2018-12-06T18:03:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-11-28T10:54:58+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/og_01@2x.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@floopily\" \/>\n<meta name=\"twitter:site\" content=\"@GoSquared\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"JT\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\",\"name\":\"GoSquared\",\"url\":\"https:\/\/www.gosquared.com\/blog\/\",\"sameAs\":[\"https:\/\/instagram.com\/gosquaredteam\",\"https:\/\/www.linkedin.com\/company\/go-squared-ltd.\",\"https:\/\/www.facebook.com\/GoSquared\",\"https:\/\/twitter.com\/GoSquared\"],\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png\",\"contentUrl\":\"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png\",\"width\":1270,\"height\":250,\"caption\":\"GoSquared\"},\"image\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#website\",\"url\":\"https:\/\/www.gosquared.com\/blog\/\",\"name\":\"GoSquared Blog\",\"description\":\"Turn visitors into customers.\",\"publisher\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.gosquared.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage\",\"url\":\"\",\"contentUrl\":\"\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage\",\"url\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard\",\"name\":\"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable. - GoSquared Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage\"},\"datePublished\":\"2018-12-06T18:03:00+00:00\",\"dateModified\":\"2019-11-28T10:54:58+00:00\",\"description\":\"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.gosquared.com\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable.\"}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage\"},\"author\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/bfcd35bf2eba92ecbeea67937cd23eef\"},\"headline\":\"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable.\",\"datePublished\":\"2018-12-06T18:03:00+00:00\",\"dateModified\":\"2019-11-28T10:54:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage\"},\"wordCount\":1933,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage\"},\"thumbnailUrl\":\"\",\"keywords\":[\"AWS\",\"Real-Time\",\"Reinvent\"],\"articleSection\":[\"Engineering\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/bfcd35bf2eba92ecbeea67937cd23eef\",\"name\":\"JT\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/772e026206b900a5ba17ebbe63e34a4c8a9103524cf0ba3accfa38b14d7d03ba?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/772e026206b900a5ba17ebbe63e34a4c8a9103524cf0ba3accfa38b14d7d03ba?s=96&d=mm&r=g\",\"caption\":\"JT\"},\"description\":\"JT is a co-founder and the lead front-end engineer at GoSquared. He's responsible for the shiniest of the shiny projects we work on.\",\"sameAs\":[\"https:\/\/twitter.com\/floopily\"],\"url\":\"https:\/\/www.gosquared.com\/blog\/author\/jt\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable. - GoSquared Blog","description":"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard","og_locale":"en_US","og_type":"article","og_title":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable.","og_description":"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!","og_url":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard","og_site_name":"GoSquared Blog","article_publisher":"https:\/\/www.facebook.com\/GoSquared","article_published_time":"2018-12-06T18:03:00+00:00","article_modified_time":"2019-11-28T10:54:58+00:00","twitter_card":"summary_large_image","twitter_image":"https:\/\/static.gosquared.com\/images\/liquidicity\/18_12_06_leaderboards\/og_01@2x.jpg","twitter_creator":"@floopily","twitter_site":"@GoSquared","twitter_misc":{"Written by":"JT","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Organization","@id":"https:\/\/www.gosquared.com\/blog\/#organization","name":"GoSquared","url":"https:\/\/www.gosquared.com\/blog\/","sameAs":["https:\/\/instagram.com\/gosquaredteam","https:\/\/www.linkedin.com\/company\/go-squared-ltd.","https:\/\/www.facebook.com\/GoSquared","https:\/\/twitter.com\/GoSquared"],"logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png","contentUrl":"https:\/\/www.gosquared.com\/blog\/wp-content\/uploads\/2015\/07\/gosquared.png","width":1270,"height":250,"caption":"GoSquared"},"image":{"@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"WebSite","@id":"https:\/\/www.gosquared.com\/blog\/#website","url":"https:\/\/www.gosquared.com\/blog\/","name":"GoSquared Blog","description":"Turn visitors into customers.","publisher":{"@id":"https:\/\/www.gosquared.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.gosquared.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage","url":"","contentUrl":""},{"@type":"WebPage","@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage","url":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard","name":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable. - GoSquared Blog","isPartOf":{"@id":"https:\/\/www.gosquared.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage"},"datePublished":"2018-12-06T18:03:00+00:00","dateModified":"2019-11-28T10:54:58+00:00","description":"In this post we look at how we built the realtime DeepRacer Leaderboards for AWS re:Invent 2018, and how you could build something similar!","breadcrumb":{"@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.gosquared.com\/blog"},{"@type":"ListItem","position":2,"name":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable."}]},{"@type":"Article","@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#article","isPartOf":{"@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage"},"author":{"@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/bfcd35bf2eba92ecbeea67937cd23eef"},"headline":"How to build a real-time leaderboard that\u2019s serverless, fault-tolerant, and scalable.","datePublished":"2018-12-06T18:03:00+00:00","dateModified":"2019-11-28T10:54:58+00:00","mainEntityOfPage":{"@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#webpage"},"wordCount":1933,"commentCount":0,"publisher":{"@id":"https:\/\/www.gosquared.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#primaryimage"},"thumbnailUrl":"","keywords":["AWS","Real-Time","Reinvent"],"articleSection":["Engineering"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.gosquared.com\/blog\/building-the-deepracer-leaderboard#respond"]}]},{"@type":"Person","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/bfcd35bf2eba92ecbeea67937cd23eef","name":"JT","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.gosquared.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/772e026206b900a5ba17ebbe63e34a4c8a9103524cf0ba3accfa38b14d7d03ba?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/772e026206b900a5ba17ebbe63e34a4c8a9103524cf0ba3accfa38b14d7d03ba?s=96&d=mm&r=g","caption":"JT"},"description":"JT is a co-founder and the lead front-end engineer at GoSquared. He's responsible for the shiniest of the shiny projects we work on.","sameAs":["https:\/\/twitter.com\/floopily"],"url":"https:\/\/www.gosquared.com\/blog\/author\/jt"}]}},"wps_subtitle":"A look into how we built the DeepRacer Leaderboard for AWS\u2019s re:Invent conference 2018.","_links":{"self":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts\/1714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/comments?post=1714"}],"version-history":[{"count":0,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/posts\/1714\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/media?parent=1714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/categories?post=1714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gosquared.com\/blog\/wp-json\/wp\/v2\/tags?post=1714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}