Discord is a voice and text communication app for online computer gamers. Discord’s goal is to become the de-facto standard communication app for PC gamers, and they’ve seen success, boasting 2.4 million concurrent users and over 25 million registrations as of July 2016.
Discord’s Challenge: Mitigating DDoS Attacks on Websockets Servers at Scale
As Discord prepared for rapid growth, they needed an affordable way to quickly scale their existing hardware infrastructure, while maintaining performance and security. Performance wise, Discord would need to transition from serving their content from a single homed server to a high performing CDN (Content Delivery Network) partner that could serve their static assets from all around the globe. Security wise, Discord needed to protect their websockets-based traffic from the rampant DDoS attacks that they were experiencing. As CTO Stanislav Vishnevskiy explained, "Since we are a gamer focused product we attract a lot of users who love to DDoS each other during game matches. As we grew more popular the intensity and occurrences of these DDoS attacks increased to the point where our engineers were constantly dealing with them." Vishnevskiy continued, "Before Cloudflare, we were using a large number of HAProxy boxes with DNS load balancing to be able to failover during DDoS attacks on our real-time gateways." However, their initial hardware solution could cost Discord up to six figures annually at scale and would still require work from Discord's engineers . Discord thus needed an affordable, easily scalable solution to stop these attacks or, according to Vishnevskiy, Discord's customer experience and retention would significantly drop: "Every single outage would result in frustrated customers. While most existing customers were tolerant to the outages, new customers that signed up during the issues retained poorly due to very bad first impressions. Every time a customer got frustrated and lapsed, it pushed us further from our goal of becoming the de-facto communication app for gamers."
Discord’s Solution: A CDN With Built-In Security
In August 2015, Discord came to Cloudflare just as they hit 25,000 concurrent users, and Cloudflare provided immediate, lasting performance and security benefits. Discord easily scaled the business to their current 2.4 million concurrent users (over 9000% growth in just one year), by leveraging Cloudflare's Content Distribution Network (CDN). Cloudflare's CDN works by caching content to data centers in over 250 cities, and then serving it directly to users from the nearest Data Center. Over 2 Pb of Discord's traffic per month is served directly from Cloudflare's edgeside cache to Discord's users. In turn, Discord, a Google Cloud customer, both provides customers with a snappier application through the high speed interconnections between Cloudflare and Google Cloud and saves over $100,000 monthly on their Google Cloud bill. In addition, Discord gets tremendous comfort from knowing Cloudflare's security is always on protecting and serving their traffic. As Jake Heinz, a software engineer at Discord, explains "We have Cloudflare sit in front of our websockets servers to absorb Layer 7 attacks and various layer 3 & 4 reflection attacks. We have 2.4 million concurrent users connected through Cloudflare to us, and Cloudflare quickly and securely serves our traffic even with spikes of websocket events up to 2 million/second."