Customer Stories/ Software & Internet

2023
PubNub Logo

PubNub Achieved Global Scalability and Low Latency Using Amazon DynamoDB

Learn how real-time interactivity platform PubNub achieved nearly infinite scalability while cutting costs by over 50 percent using Amazon DynamoDB.

More than 50%

reduction in database costs

Sub-100 ms

latency for one billion devices worldwide

10x

faster read latency than previous database setup

Supports 350,000

developers using App Context with high performance and reliability

Compliant

with HIPAA, GDPR, SOC 2 Type II, and ISO 27001

Overview

Developers choosePubNub,a platform for building and operating real-time interactive applications, for its global scalability, low latency, and strong security. However, PubNub’s staff was spending an exorbitant amount of time managing on-premises PostgreSQL databases to deliver those benefits. As the small enterprise grew its customer base, infrastructure management increasingly became a burden. The company turned to Amazon Web Services (AWS) to find cost-effective, efficient scalability and reliability.

In just 1 month, PubNub migrated toAmazon DynamoDB,a fully managed, serverless, key-value database designed to run high-performance applications at virtually any scale. Using Amazon DynamoDB, PubNub can provide nearly infinite global scalability, low latency worldwide, and data security to 350,000 developers without spending any time on infrastructure management, at a fraction of the cost of its previous databases.

PubNub real-time messaging

Opportunity|Using Amazon DynamoDB to Achieve Cost-Effective Scaling

Founded in 2010, PubNub is used by more than 350,000 developers as part of a modern application stack to power features that require near-real-time communication and collaboration between users at any scale. Developers can use PubNub to build experiences like chat apps, digital whiteboards, near-real-time dashboards with live updates, maps with live location overlays, and many other features that rely on near-real-time updates and instant communication. Developers use tools like App Context, an API that adds important contextual data to the real-time stream of events. “Real time is becoming an imperative across all industries now that remote-first is the new norm,” says Jonas Gray, vice president of business and corporate development at PubNub. “From engaging in a live stream to getting a high five from your fitness coach, bidding in an online auction, or benefiting from a telemedicine visit with the help of live sensor data, milliseconds matter.”

To facilitate real-time data streaming, PubNub had to constantly monitor its PostgreSQL databases and invest in patching, backups, software upgrades, and more. To meet high traffic demands, PubNub had to provision capacity for peak workloads resulting in investment in multi-terabyte machines, many of which would sit idle most of the time. It also had to manually scale up for high traffic. PubNub needed a managed database service with a global footprint and automated database replication to grow quickly and optimize costs as its customers scaled and added increasingly diverse, complex, and unpredictable workloads.

Having used AWS since 2011, PubNub first migrated its PostgreSQL relational database to run onAmazon Relational Database Service(Amazon RDS), a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud, andAmazon Elastic Compute Cloud(Amazon EC2), which offers secure and resizable compute capacity for virtually any workload. While that move off-loaded hardware management onto AWS, PubNub’s rapid growth required it to advance its modernization journey by migrating to Amazon DynamoDB, which offers automated, nearly infinite, and pay-as-you-go scaling without the overhead of relational database management. “Amazon DynamoDB has built-in global tables and replication that PubNub could use to offer a high level of message bus technology at a database level. By migrating to DynamoDB, the company could then provide high local performance and reliability to customers connecting across different regions.”

kr_quotemark

Amazon DynamoDB automatically scales, and it does a way better job than we could do manually with a team of site reliability engineers. "

Stephen Blum
Cofounder and Chief Technology, PubNub

Solution|Using Amazon DynamoDB to Scale Globally at Sub–100 ms Latency

In August 2022, PubNub benchmarked and tested Amazon DynamoDB, adding 300 times the load of previous spikes. Within 2 hours, Amazon DynamoDB completed 300 million read and write transactions, with 10–20 ms latency. In just 2 weeks, PubNub implemented and deployed Amazon DynamoDB, and in another 2 weeks, it went to production. “AWS worked alongside us to design a few iterations of the database model to plan how to access the data,” Blum says. “We went to market quickly because we had AWS staff on hand.”

Using a DevOps model, PubNub reduced database costs by more than 50 percent on Amazon DynamoDB compared with PostgreSQL. “Amazon DynamoDB automatically scales, and it does a way better job than we could do manually with a team of site reliability engineers,” says Blum. The read latency of Amazon DynamoDB is below 10 ms, which is 10 times faster than PostgreSQL. On Amazon DynamoDB, PubNub was able to achieve the performance and reliability required to offer 99.999 percent service-level agreements to its pro-level customers globally, and it supports 350,000 developers using App Context.

Currently, PubNub takes advantage of 43 AWS services across 22 AWS Regions, and AWS covers PubNub’s security requirements - the company is SOC 2 Type II and ISO 27001 compliant and adheres to HIPAA regulations and General Data Protection Regulation (GDPR) data regulations. Although Amazon DynamoDB handles 95 percent of API calls to fetch and read data from the database, sometimes PubNub’s customers need to run more advanced searches across their existing dataset. PubNub added indexing and query capabilities on top of Amazon DynamoDB usingAmazon OpenSearch Service,which makes it simple to perform interactive log analytics, near-real-time application monitoring, website search, and more. PubNub creates indexes usingDynamoDB Streams,which writes stream records in near real time and copies those indexes to Amazon OpenSearch Service.

On AWS, PubNub provides near-real-time communications with sub–100 ms latency to a billion connected devices worldwide, with 3.5 trillion API calls per month and over 46 billion edge messages delivered monthly. The company has even supported a world-record-setting live sporting event that saw over 25 million concurrent users engaging in near real time by voting on the next play with instant rewards. “Customers who use AWS see better, faster experiences by sharing the same network, which is a great selling point for us,” says Blum.

PubNub has increased staff productivity by using the fully managed service and automatic scaling of Amazon DynamoDB, freeing engineers to focus on innovation. “Our team was excited to close out the instances that they no longer had to manage,” says Blum. “Taking advantage of those compute capabilities makes it simple for us to innovate faster.”

Outcome|Diving Deeper into Near-Real-Time Data Visibility on AWS

The company plans to use AWS as it develops more tools and features to help customers harness the value of their data in near real time—for example, to improve social interactions in massively multiplayer online games, where PubNub has found continuing success across hundreds of key customers, including Pocket Gems, Scopely, and Beamable. By becoming anAWS Partner,PubNub gained access to technical, marketing, and funding resources from AWS that it uses to innovate and better serve customers. “AWS continuously has new opportunities for us to operate more efficiently, deploy to market more quickly, and reduce costs, all of which help us grow as a company,” says Blum.

About PubNub

The PubNub platform helps teams build and operate real-time interactivity for mobile, web, and the Internet of Things. It powers all real-time use cases that require security, scalability, and reliability, including chat, live audience engagement, geolocation, and more.

AWS Services Used

Amazon DynamoDB

Amazon DynamoDB is a fully managed, serverless, key-value NoSQL database designed to run high-performance applications at any scale. DynamoDB offers built-in security, continuous backups, automated multi-Region replication, in-memory caching, and data import and export tools..

Learn more »

Amazon OpenSearch Service

Amazon OpenSearch Service makes it easy for you to perform interactive log analytics, real-time application monitoring, website search, and more.

Learn more »

Amazon Relational Database Service

Amazon Relational Database Service (Amazon RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud.

Learn more »

More Software & Internet Customer Stories

no items found

1

Get Started

Organizations of all sizes across all industries are transforming their businesses and delivering on their missions every day using AWS. Contact our experts and start your own AWS journey today.