Heroic Labs: Achieving Flexible Deployment with CockroachDB

Quick Look

Heroic Labs simplifies deployment of their distributed gaming platform-as-a-service by packaging CockroachDB with every Nakama server.


Game Development

Company Size


Heroic Labs is a fast-growing startup that builds scalable backend architecture for the gaming industry. They needed a database that could provide a simple operating experience from deployment to production, while still being flexible enough to scale to meet their customers’ needs. CockroachDB was the best choice for Heroic Labs because of its simple user experience across the entire development cycle regardless of scale or platform.

The 3 Big Challenges

The Heroic Labs team founded the company to help businesses keep up with the demand for real-time and multiplayer games that are available 247 to millions of users across the globe. They saw that businesses were having to invest valuable engineering time in building and maintaining complex infrastructure to support scale and fault-tolerance instead of focusing on building applications that directly drive business value. Heroic Labs wanted to build an open source, distributed infrastructure solution that everyone could use. They needed a database that could support flexible deployment across the entire development cycle, while still offering strong consistency and SQL capabilities.

1. Supporting the same environment from local development to production

The developers at Heroic Labs wanted their customers to be able to quickly port over their applications from development to production environments without having to make application-level adjustments. This meant being able to support local development, but existing databases that require sharding and partitioning to scale are hard to test locally, requiring remote development environments. Although the development cycle has improved with the introduction of containers, database technologies still lag behind in this arena. CockroachDB offers a similar installation process whether locally or in the cloud, so that developers can write their application code locally against a local CockroachDB instance instead of utilizing dedicated development servers.

2. Automating infrastructure for fault tolerance and scalability

In order for their solution to work for all types of business and applications, Heroic Labs needed a system that could support fault tolerance and scalability automatically for their customers regardless of how their customers chose to deploy their solution. This meant fully embracing infrastructure as code, manipulating and managing different components with their proprietary clustering technology. Existing NoSQL solutions that provide scalability and fault tolerance were too complex to configure, set up, and manage over time. With CockroachDB, adding a node is as simple as spinning up a machine, installing the CockroachDB binary, and joining an existing cluster - all tasks that can be easily scripted with code.

3. Achieving consistency and transactions at scale

The last nail in the coffin for existing databases was their loss of consistency and transactions at scale. Relational databases give up cross-shard transactions, while distributed NoSQL databases sacrifice consistency and force application developers to accept significant data modelling trade-offs. Heroic Labs needed transactions to build their digital wallet APIs and wanted access to traditional SQL capabilities to support secondary indexes and aggregations.


CockroachDB was the only database that could meet Heroic Labs’ need for scale and consistency with an easy deployment model that could be packaged with the Nakama server.

Every customer using the Nakama server is relying on CockroachDB to store their most important persistent data in a fault tolerant and scalable way. Heroic Labs uses Kubernetes in conjunction with their application servers and CockroachDB to provide a higher level of fault tolerance and scalability through automation. CockroachDB is packaged in a single binary and deployable locally, in the cloud, or on-premise, giving Heroic Labs the end-to-end deployment experience they need to meet their customers’ needs. CockroachDB also manages scaling, rebalancing, and repair internally, so that Heroic Labs could fully automate their own distributed servers on top of CockroachDB, without worrying about how to manage the database layer as they scaled. This means that Heroic Lab developers can expect CockroachDB to survive failures and scale capacity transparently to applications, while continuing to provide the strong consistency and SQL capabilities that developers know and love.


The Heroic Labs developer team started using CockroachDB in early 2016, releasing their 1.0 product in mid-2017. They have since become experts in the open source code base so that they can contribute throughout the entire stack. CockroachDB now comes packaged with every Nakama server, providing the consistent and scalable database foundation Heroic Labs needs to make their customers successful while supporting automated on-premise and cloud deployment. Gaming companies including Nyan Co, V2 Games, Nazara Games, and Radmule Labs rely on both the Nakama server and CockroachDB to power their game development processes.