CASE STUDY

Mux Goes Multi-Cloud & Multi-Region with CockroachDB

Migrating from Postgres to Distributed SQL in search of high availability, low latency and hybrid/multi-cloud flexiblity

  • ZERO DOWNTIME between upgrades

  • MULTI-REGION compliance / performance

  • MULTI-CLOUD / HYBRID flexibility

Mux is a platform that enables developers to build high-quality live and on-demand video streaming experiences. Mux originally built their Mux Data service on a mix of PostgreSQL and other open source databases. While this worked for their analytics platform, there were critical capabilities that their current databases could not provide.

The biggest drivers behind the Mux Video platform are the promise of being multi-region and multi-cloud, as well as consistent high availability. With platforms like Netflix setting the uptime standard for streaming video, avoiding database downtime was a must. Mux needed a new database that could deliver all of these essentials — and they found it in CockroachDB.

We plugged in CockroachDB, and it just worked — which alleviates the need for the ongoing maintenance required when you create and manage your own database. - Adam Brown, Co-Founder & Head of Infrastructure at Mux

Challenges

Mux supports a range of company sizes in a wide variety of industries who all have one thing in common - they create their own video platforms. This requires Mux to store massive amounts of video-related metadata: where the video is stored; what state the video is in; how the video is encoded; how and when it was ingested; and more.

One of the requirements of Mux Video is that it must support multi-cloud deployments. Mux’s clients store data in different clouds, so the product would need to work in their clients’ cloud of choice.

Mux Video also would need to meet the uptime and delivery standards set by commercial streaming services – as in, maximize uptime and retrieve data quickly from the database. Typically, metadata does not take up a lot of space, but items like keyframe maps are critical for just-in-time transcoding. Many of Mux’s clients use Mux Video to power user-generated content applications that can range from five-second video snippets to hour-long recordings. The volume of video can be large, so a forward-thinking solution that could enable fast delivery to distributed customers was critical.

Requirements

Building a solution on top of PostgreSQL was out of the question, as it would be time-prohibitive to make it meet the basic product requirements. Yet as the team investigated options, including cloud providers, it came to the conclusion that other products only offered partial solutions — while CockroachDB satisfied all requirements out of the box.

Mux began evaluating CockroachDB as it built its video platform. Their requirements included:

  • High availability for maximum uptime.
  • Support for running in multiple regions to provide fast delivery to distributed customers.
  • The freedom to use multiple cloud services to avoid vendor lock-in on any particular cloud.

CockroachDB provided all these must-have features and now serves as the backbone for Mux Video.

Solution & Implementation

The team found that, beyond satisfying all their requirements, CockroachDB was also an easy transition from PostgreSQL.

Uptime. With CockroachDB’s intelligent traffic routing across multiple replicas (recommended: no fewer than three replicas), machine failures and maintenance issues would not cause downtime for customers.

Performance. In order to provide fast delivery to their users, Mux took advantage of two CockroachDB capabilities: multi-region deployments and geo-partitioning.

  1. Multi-region: The ability to deploy Mux in multiple regions to optimize latency and availability, managing data across multiple cloud availability zones and regions circling the globe. CockroachDB allowed the team to control their data’s latency and availability with just a few declarative SQL statements.
  2. Geo-partitioning. The ability to pin data to specified locations at the row-level — a capability no other database solution offers.

Combining geo-partitioning with multi-region deployments enables Mux to deliver fast reads and writes to distributed customers in specified locations across multiple regions. Geo-partitioning also enables Mux to be compliant with regional data privacy regulations like the General Data Protection Regulation (GDPR).

Migration. Finally, much of the original Mux Video prototypes were built on PostgreSQL. The development team was able to use CockroachDB as a drop-in replacement for PostgreSQL with minimal changes. CockroachDB uses the PostgreSQL-native drivers, allowing development teams to continue working in SQL, which was familiar to them, without having to modify or transform data to use CockroachDB.

To facilitate the integration process, CockroachDB engineers came on-site for a review with the technical team, providing recommendations to help Mux Video run better on CockroachDB. Operationally, the team reported, CockroachDB was easy to get running compared to many other open source databases.

Results

Mux now uses CockroachDB as the database backbone for Mux Video. As it continues to solidify the video platform, the company has been using backup and restore functionality, as well as working with the geo-partitioning features to allow videos to remain in the region where they are ingested to speed up performance.

CockroachDB, and geo-partitioning in particular, will be critical as Mux navigates where and how to store EU metadata in accordance with GDPR. Using CockroachDB ensures that videos are coalesced to the correct region, and that the data is coded and packaged as requested.

Future-Proofing

Mux considers its choice of CockroachDB to be “future proofing” its operations. As Mux Data continues to expand its footprint, including moving its customer database to CockroachDB, geo-partitioning will help the company comply with EU GDPR regulations.

Additionally, as its customer base continues to grow, Mux plans to scale regarding the total video volume, and will be able to experience even more impactful benefits around speed and cost savings.

CockroachDB will continue to be the database backbone of Mux Video, enabling Mux to continue its rapid growth and deliver a video streaming and analytics platform that helps customers create world-class video experiences.

Ready To Get Started?