CockroachDB Serverless: Free. Seriously.

CockroachDB Serverless: Free. Seriously.

CockroachDB Serverless:

Start here. Build fast. Scale anywhere.

Get started

[This post was originally published in October 2022. It has been updated to reflect current product offerings.]

Traditionally, one of the stickiest decisions developers need to make when creating a database is choosing how many servers to use based on expected application traffic. Guess too low and your db could fall over under load, causing an outage. Guess too high, you pay for servers that just sit idle most of the time. Spiky loads? Uh oh, gotta overprovision to make sure those surges get handled even if it means wasted capacity 90%+ of the time. 

Serverless databases are the cure for this perennial headache because now developers never need to think about allocating, configuring or maintaining servers. (This is why we call it serverless, which is kind of awkward as a name but easier than Servers-as-a-Service). A serverless database will also expand and contract based on workload, all without intervention from a developer or ops personnel, automatically scaling up to handle a sudden spike in traffic and then back down post-event. 

Elastic, automated scaling and consumption-based usage rates are core tenets of serverless anything, not just databases. The implicit promise of serverless is “You pay for what you use when you use it. When not in use, everything scales down to zero” — so you always have the right capacity and never overspend.

The problem is, not all serverless databases actually scale to zero.

When is a “serverless database” not actually serverless?

There are, of course, many distributed databases that can scale out automatically. The problem? Almost every distributed state store on the planet has a minimum scale required to operate and not everyone has a limitless budget — whether you’re a startup, a midsize company, or a development team at a larger org trying to spend efficiently on your testing infrastructure.

This is when a serverless database is a developer’s new best friend. You pay only for what your application (or testing environment) actually consumes, without needing to figure out up front what that might be. If your workloads surge then more hardware is automatically allocated to handle the increased load; when the surge passes, it spins back down again. If your app is making zero requests against the database, then your usage is zero and your bill is zero.

[ blog ]

How we built a serverless SQL database

read blog →

It’s important to read the fine print when choosing a serverless database. To make sure that, when not in use, it does indeed scale down to nothing and stops charging you. As Corey Quinn points out on his blog, Last Week in AWS, “Buried in the documentation, AWS states that ‘Currently, Aurora Serverless v2 writers and readers don’t scale all the way down to zero ACUs’. As a result, the lowest you’ll pay a month for one of these things is the princely sum of just shy of $45.” 

In other words, even if your application makes not one single request against that serverless database, you still have to pay for usage you never actually used…Which violates the fundamental “scaling to zero” premise of serverless. 

Q: When is a free serverless database truly free as in beer?

A: When it’s CockroachDB Serverless.

CockroachDB Serverless lets you create a free, cloud-hosted CockroachDB instance in seconds with just a few clicks or an API call. You can program against it using your favorite language, SDK, or tooling in the application development environment of your choice, including many popular Postgres tools. CockroachDB Serverless automatically and transparently scales capacity and storage to meet demand, no matter how big or small, with no changes to your application. You can make schema changes live in production without taking the database offline. And, yes, it scales all the way down to zero. With CockroachDB Serverless, you truly only pay for what you use. 

And did we mention that what you pay may actually be…zero?  Because you can use CockroachDB Serverless for free.

Seriously: Free. For everybody. Including a 99.99% uptime service level agreement for all CockroachDB Serverless clusters.

The initial tier for all CockroachDB Serverless users is a monthly credit for requests and storage. If you have lighter workloads you’ll pay less, or even nothing at all. Even if your usage goes above the free allotment, you’ll never be surprised by a bill because you designate a monthly resource limit. We’ll alert you as you approach that limit, and even continue providing a free baseline level of performance if you exceed it. 

(If you’re curious, read about the innovative serverless architecture Cockroach Labs engineers created to securely host thousands of virtualized CockroachDB Serverless clusters on a single underlying physical CockroachDB database cluster).

Request Units

CockroachDB Serverless charges you only for the actual data storage and activity of your cluster, with automatic monthly account credits so that low usage equals low or even no charge. 

  • Data storage is straightforward, measured in GiB per month based on the total volume of storage used over the billing period. 
  • Cluster activity is measured in Request Units (RUs), an abstracted metric that represents the size and complexity of requests made to your database. This includes SQL queries, bulk operations, and background jobs. RU consumption scales to zero when your cluster has no activity, so you will only be charged for what you actually use. Learn about Request Units in the CockroachDB docs.

Our docs contain a great deal more than we can cover in a single blog post: CockroachDB Serverless burst pricing and resource limits, tuning your serverless workload to optimize usage, and understanding how request units work. This is also where you will find current information on serverless storage, RU credits, and burst pricing.

Learn more and get started on CockroachDB Serverless

Head on over to https://cockroachlabs.cloud/ and give it a try for yourself. Cockroach University also offers a free course, Introduction to Serverless Databases and CockroachDB Serverless, exploring serverless database core concepts and providing the tools you need to get started with CockroachDB Serverless. And of course you can always consult the CockroachDB Serverless FAQ in our docs.

If you have questions about any of this, please join the CockroachDB slack channel and ask away. We’d also love to hear about your experience with CockroachDB Serverless — or, even better, show us what you are building! Finally, if you’d like to help us take CockroachDB to the next level, we’re hiring.

About the author

Michelle Gienow github link linkedin link

Michelle Gienow is a recovering journalist turned front end developer based in Baltimore, MD. She creates content around her central obsessions: Jamstack, distributed architecture and developing a cloud native mindset.

Keep Reading

How CockroachDB operates serverless clusters with Kubernetes

Welcome! If you find yourself here wondering What does “serverless database" even mean? you may want to start with …

Read more
How to build a serverless polling application

Very few traditions can melt the corporate ice as well as an ugly holiday sweater contest. Which is why, this past …

Read more
How to build a complete Next.js app with Vercel and CockroachDB

In this tutorial, we’ll create an app for coordinating social events. In the process, you’ll see how simple it can …

Read more