{"id":34,"date":"2024-02-13T14:03:23","date_gmt":"2024-02-13T11:03:23","guid":{"rendered":"http:\/\/caitiem.com\/?p=34"},"modified":"2024-02-13T15:28:56","modified_gmt":"2024-02-13T12:28:56","slug":"clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived","status":"publish","type":"post","link":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/","title":{"rendered":"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived"},"content":{"rendered":"\n

At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.<\/p>\n\n\n\n

With AAA video games, especially multiplayer games, week one is when you see the most concurrent users.  Like Blockbuster movies, large marketing campaigns, trade shows, worldwide release dates, and press all converge to create excitement around launch.  Everyone wants to see the movie or play the game with their friends the first week it is out.  The energy around a game launch is intoxicating.  However, running the services powering that game is terrifying.  There is nothing like production data, and we were about to get a lot of it over the next few days.  To be precise Halo 4 saw 4 million unique users in the first week who racked up 31.4 million hours of gameplay.<\/p>\n\n\n\n

At midnight on November 6th PST I stood in a parking lot outside of a Microsoft Store in Seattle surrounded by 343i team members and fans who came out to celebrate the launch with us and get the game at midnight PST.  I checked in with the on call team, Europe and the East Coast of the US had also come online smoothly.  In addition the real time Cheating & Banning system I wrote in a month and half before launch had already caught and banned 3 players who had modded their Xbox in the first few hours, I was beyond thrilled.  Everything was going according to plan so after a few celebratory beers, I headed back into the office to take over the graveyard shift and continue monitoring the services.  The next 48 hours were critical and likely when we would be seeing our peak traffic.<\/p>\n\n\n\n

As the East Coast of the United States started playing Halo after work on launch day we hit higher and higher numbers of concurrent users.  Suddenly one of our APIs related to Cheating & Banning was hitting an abnormally high failure rate, and starting to affect other parts of the Statistics Service.  As the owner of the Halo 4 Statistics Service and the Cheating & Banning Service I Ok\u2019d throwing the kill switch on the API and then began digging in.<\/p>\n\n\n\n

The game was essentially DoSing us.  We were receiving 10x the number of expected requests to our service on this particular API, due to a bug in the client which reported suspicious activity for almost all online players.  The increased number of requests caused us to blow through our IOPS limit in Azure Storage, which correctly throttled and rejected our exorbitant number of operations.  This caused the request from the game to fail, and then the game would retry the request three times, creating a retry storm, only exacerbating the attack.<\/p>\n\n\n\n

Game Over Right?  Wrong.  Halo 4 had no major outages during launch week, the time notorious for games to have outages<\/a>.  The Halo 4 Services survived because they were architected for maximum availability and graceful degradation.  The core APIs and component of the Halo Services necessary to play the game were explicitly called out and extra measures were taken to protect them.  We had a game plan to survive launch, which involved sacrificing everything that was not those core components if necessary.  Our team took full ownership of our core service\u2019s availability, we did not just anticipate failure, we expected it.  We backed up our backups for statistics data requiring multiple separate storage services to fail before data loss would occur, built in kill switches for non essential features, and had a healthy distrust of our clients.<\/p>\n\n\n\n

The kill switch I mentioned earlier saved the services from the onslaught of requests made by the game.  We had built in a dynamically configurable switch into our routing layer, which could be tuned per API.  By throwing the kill switch, we essentially re-routed traffic to a dummy handler which returned a 200 and dropped the data on the floor or logged it to a storage account for later analysis.  This stopped the retry storm, stabilized the service, and alleviated the pressure on the storage accounts used for Cheating & Banning.  In addition, the Cheating & Banning service continued to function correctly because we had more reliable data coming in via game events on a different API.<\/p>\n\n\n\n

The game clients were being jerks (a bug in the code caused an increase in requests) so I had no qualms about lying to them (sending back an HTTP 200 and then promptly dropping the data on the floor) especially since this API was not one of the critical components for playing Halo 4.  In fact had we not built in the ability to lie to the clients we most certainly would have had an outage at launch.<\/p>\n\n\n\n

But the truth is the game devs I worked closely with over countless tireless hours leading up to launch weren\u2019t jerks, and they weren\u2019t incompetent.  In fact they were some of the best in the industry.  We all wanted a successful launch so how did our own in house client end up DoSing the services? The answer is Priorities.  The client developers for Halo 4 have a much different set of priorities: gameplay, graphics, and peer to peer networking were at the forefront of their mind and resource allocations, not how many requests per second they were sending to the services.<\/p>\n\n\n\n

Client priorities are often very different than the services they consume, even in house clients.  This is true for games, websites, mobile apps, etc\u2026  In fact it is not only limited to pure clients it is even true for microservices communicating with one another.  These priority differences manifest in a multitude of ways: sending too much data on a request, sending too many requests, asking for too much data or an expensive query to be ran, etc\u2026 The list goes on and on, because the developers consuming your service are often focused on a totally different problem and not your failure modes and edge cases.  In fact one of the major benefits of SOA and microservices is to abstract away the details of a service\u2019s execution to reduce the complexity one developer has to think about at any given time.<\/p>\n\n\n\n

Bad client behavior happens all over the place not just in games. Astrid Atkinson just said in her Velocity Conf talk<\/a> \u201cGoogle\u2019s biggest DoS attacks always comes from ourselves.\u201d  In addition, I\u2019m currently working on fixing a service at Twitter which is completely trusting of internal clients allowing them to make exorbitant requests.  These requests result in the service failing, a developer getting paged with no means of remediating the problem, and the inspiration for finally writing this post.  Misbehaving clients are common in all stacks, and are not the bug.  The bug is the implicit assumption that because the clients are internal they will use the API in the way it was designed to be used.<\/p>\n\n\n\n

Implicit assumptions are the killer of any Distributed System.<\/p>\n\n\n\n

Truly robust, reliable services must plan for bad client behavior and explicitly enforce assumptions.  Implicitly assuming that your clients will \u201cdo the right thing\u201d makes your services vulnerable.  Instead explicitly set limits and enforce them either manually via alerting, monitoring and operational runbooks, or automatically via backpressure, and flow control.  Halo 4 launch was successful because we did not implicitly trust our clients instead we assumed they were jerks.<\/p>\n\n\n\n

Much thanks to Ines Sombra for reviewing early drafts<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"

At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play….<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"yoast_head":"\nClients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com<\/title>\n<meta name=\"description\" content=\"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com\" \/>\n<meta property=\"og:description\" content=\"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/\" \/>\n<meta property=\"og:site_name\" content=\"caitiem.com\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-13T11:03:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-13T12:28:56+00:00\" \/>\n<meta name=\"author\" content=\"caiti335\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"caiti335\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/\",\"url\":\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/\",\"name\":\"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com\",\"isPartOf\":{\"@id\":\"https:\/\/www.caitiem.com\/#website\"},\"datePublished\":\"2024-02-13T11:03:23+00:00\",\"dateModified\":\"2024-02-13T12:28:56+00:00\",\"author\":{\"@id\":\"https:\/\/www.caitiem.com\/#\/schema\/person\/0ea20eb328afb663a23dc72ebeced8c0\"},\"description\":\"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.\",\"breadcrumb\":{\"@id\":\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\",\"item\":\"https:\/\/www.caitiem.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.caitiem.com\/#website\",\"url\":\"https:\/\/www.caitiem.com\/\",\"name\":\"caitiem.com\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.caitiem.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.caitiem.com\/#\/schema\/person\/0ea20eb328afb663a23dc72ebeced8c0\",\"name\":\"caiti335\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.caitiem.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/08e6287ee41d891ed906aa45a965ba3c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/08e6287ee41d891ed906aa45a965ba3c?s=96&d=mm&r=g\",\"caption\":\"caiti335\"},\"url\":\"https:\/\/www.caitiem.com\/author\/caiti335\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com","description":"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.","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":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/","og_locale":"en_US","og_type":"article","og_title":"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com","og_description":"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.","og_url":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/","og_site_name":"caitiem.com","article_published_time":"2024-02-13T11:03:23+00:00","article_modified_time":"2024-02-13T12:28:56+00:00","author":"caiti335","twitter_card":"summary_large_image","twitter_misc":{"Written by":"caiti335","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/","url":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/","name":"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived - caitiem.com","isPartOf":{"@id":"https:\/\/www.caitiem.com\/#website"},"datePublished":"2024-02-13T11:03:23+00:00","dateModified":"2024-02-13T12:28:56+00:00","author":{"@id":"https:\/\/www.caitiem.com\/#\/schema\/person\/0ea20eb328afb663a23dc72ebeced8c0"},"description":"At 3am PST November 5th 2012 I sat fidgeting at my desk at 343 Industries watching graphs of metrics stream across my machine, Halo 4 was officially live in New Zealand, and the number of concurrent users began to gradually increase as midnight gamers came online and began to play. \u00a0Two hours later at 5am Australia came online and we saw another noticeable spike in concurrent users.","breadcrumb":{"@id":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.caitiem.com\/2015\/06\/23\/clients-are-jerks-aka-how-halo-4-dosed-the-services-at-launch-how-we-survived\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u0413\u043b\u0430\u0432\u043d\u0430\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430","item":"https:\/\/www.caitiem.com\/"},{"@type":"ListItem","position":2,"name":"Clients are Jerks: aka How Halo 4 DoSed the Services at Launch & How We\u00a0Survived"}]},{"@type":"WebSite","@id":"https:\/\/www.caitiem.com\/#website","url":"https:\/\/www.caitiem.com\/","name":"caitiem.com","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.caitiem.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.caitiem.com\/#\/schema\/person\/0ea20eb328afb663a23dc72ebeced8c0","name":"caiti335","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.caitiem.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/08e6287ee41d891ed906aa45a965ba3c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/08e6287ee41d891ed906aa45a965ba3c?s=96&d=mm&r=g","caption":"caiti335"},"url":"https:\/\/www.caitiem.com\/author\/caiti335\/"}]}},"_links":{"self":[{"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/posts\/34"}],"collection":[{"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/comments?post=34"}],"version-history":[{"count":1,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/posts\/34\/revisions"}],"predecessor-version":[{"id":41,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/posts\/34\/revisions\/41"}],"wp:attachment":[{"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/categories?post=34"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.caitiem.com\/wp-json\/wp\/v2\/tags?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}