A Flywheel for SaaS Databases ft. Postgres and Citus

What happens to your database when your SaaS application is an overnight success? When your customer base has grown bigger than you’d always hoped but it all happened so fast and now what do you do? What happens when your SaaS application needs to scale, but your database is getting more and more sluggish?

Until recently, the conventional wisdom for SaaS startups is that you should launch your application on top of an open source relational database, like Postgres or MySQL. And that once you become an overnight success, you will need to slog your way through a period of fail whales while you re-architect your app to go to NoSQL. Or while you re-architect your app to shard at the application layer. Ick.

From 4:00am pagers to not having to worry about your database

Several months ago, Craig Kerstiens (our head of cloud) went out to lunch with one of our customers, a CTO of a SaaS company. After getting through all the usual small talk (football? wine? kids?), Craig asked the CTO how his experience had been with Citus Cloud the past few months. And the CTO turned to Craig, without missing a beat, and said he hadn’t even thought about his database since he’d finished the migration onto Citus Cloud.

The CTO had gone from the all too painful, routine ring of 4:00am pagers with his previous single-node Postgres database—plus having to write awkward letters to his customers to apologize for the sluggish performance of his app—to being able to forget about his database with Citus Cloud.

For me, that was the ultimate compliment.

Previously on… the Citus Data blog

So, if you are already a reader of our Citus Data blog, or you subscribe to our newsletter—please feel free to skip right on ahead. But just like any great episode of your favorite TV series, a recap sequence seems in order.

So here you go, for the unfamiliar: Citus Cloud is our fully-managed database as a service that scales out Postgres in the cloud. We scale out Postgres across multiple nodes and distribute transactions and SQL queries to get massive parallelism—as well as much bigger compute, memory, and disk resources for the database. We get used a lot by SaaS businesses with multi tenant applications as well as real-time analytics dashboards.

Because Citus is an extension to Postgres (we’re not a fork), it’s easy for us to keep Citus current with the latest releases of Postgres. So yes, unlike so many other variations of Postgres that are forks, Citus keeps current. In fact, Citus is already packaged and deployed with Postgres 10.1, the very latest Postgres release that came out less than two weeks ago.

Run by a team with experience managing millions of Postgres databases in the cloud, Citus Cloud is hosted on AWS and available in almost all AWS regions. We take care of monitoring, backups, auto-HA, security, encryption, and seamlessly scaling out.

In short: Citus is catnip for fast-growing SaaS businesses who love Postgres and who need a relational database that scales out.

Database decision tree

Decision tree for SaaS databases—start relational, start with Postgres

SaaS businesses face a ton of important decisions when getting their business off the ground: hiring, funding, geography, office space, pricing, metrics, go to market, horizontal vs. vertical focus… the list goes on. No surprise, the architectural decision we think is super important: which database to pick. Hence the decision tree we drew above.

For SaaS companies today, it just doesn’t make sense to pick a NoSQL database like Cassandra or Mongo when you’re getting started. Because while you hope you’re going to be successful enough to need a scale-out database, you usually don’t need that kind of distributed scale in the beginning.

And who wants to give up the benefits of a relational database to get scale? Who wants to give up transactions, joins, constraints, as well as all the myriad database features scribbled below? (Chicken scratchings by our head of cloud Craig Kerstiens.)

Database feature list

I suppose another explanation for why so many SaaS businesses pick a single-node relational database when just getting started: human nature.

People are good at focusing on the required, and deferring the not-yet-required. Likewise, smart architects are good at partitioning problems into smaller parts, and solving the immediate problems now, while deferring others for later.

How many times have you heard someone say, “well that would be a good problem to have” or “we can cross that bridge when we come to it?” Or in the case of SaaS databases, you might say, “when we become so successful our database starts to fall over, that’s when we’ll move to a database that can scale out.”

Or as Peter van Hardenberg says in his advice to SaaS businesses: “use technologies for the scale you’re at.”

“Use technologies that work for the scale you’re at. Start with the best SQL database you can find: Postgres. When you start to outgrow that, Citus is a great solution.”

Peter van Hardenberg

Tl;dr about our recent Citus Cloud 2 announcement

So last week, we announced a pretty awesome update to Citus Cloud.

Craig Kerstiens (yeah, the one with the cool avatar) wrote the definitive blog post with all the details: Citus Cloud 2, Postgres, and scaling out without sacrifice.

Our announcement was all about enabling developers like you to scale out your apps without having to worry about your database—replete with cloud database features for migration (think: migration from single-node Postgres like AWS RDS over to Citus); also, followers aka read-only replicas; point-in-time recovery; forks to create database clones on which you can experiment without impacting production; zero-downtime shard rebalancer with a sweet UI; integration with Rails gems and Django libraries; and more.

A few of the comments about Craig’s Citus Cloud 2 post made me smile. One favorite comment was “Please stop making your product more awesome.” I also loved Marco Slot’s explanation on Hacker News of the use cases that our Citus database serves well.

But the best part of the Citus Cloud 2 announcement for me were the good words from our customers. Craig included a big-font, awesome quote from CTO Scott Mitchell of SalesLoft in his blog post.

And here is what Kelly Cheng, the CTO of ProsperWorks had to say:

“We were able to migrate relatively easily to run on top of Citus, even though our app had zero knowledge of sharding beforehand. And now that we’re using Citus Cloud, we don’t have to worry about how to manage our growth—not even 10X growth.”

Kelly Cheng, CTO of ProsperWorks

Today’s database flywheel for SaaS applications, ft. Postgres and Citus

Postgres scale database

More and more, SaaS businesses are no longer willing to give up relational database semantics in order to scale out. And with the Citus scale-out extension to Postgres, SaaS businesses no longer have to.

I think there’s a flywheel here that works to advantage Postgres, and Citus, and our SaaS customers.

In business and in tech, a flywheel is a system where each of the components accelerates growth of the other components, which in turn accelerates more growth.

As more developers choose Postgres as their relational database, more developers will need to scale out on Postgres. As more developers need to scale out Postgres, more developers will end up needing (and choosing) Citus. As more developers choose Citus, more people learn about Citus. As more developers learn about Citus, more developers will pick Postgres, knowing they have a great path forward (with Citus) when it’s time to scale. So… More Postgres users leads to more Citus users leads to more Postgres users leads to more Citus users. A flywheel for growth in the Postgres community.

The Citus ability to scale out Postgres in the cloud makes Postgres not only the right short-term choice for SaaS businesses, but also the ideal long-term choice for SaaS applications. Why? Because you no longer have to give up Postgres when it’s time to scale out the database.

And we’re seeing more & more evidence from our customers who have chosen Citus to scale out Postgres when they hit the limits on single-node Postgres. Rather than have to re-architect for NoSQL, or re-architect to shard at the application layer, the SaaS companies are turning to Citus.

I think that Jarred Nicholls says it best:

“Citus makes things possible for us that would have been nightmarish in a NoSQL world. Moving to Citus has improved the reliability and performance of our database, and the fact that it’s not a black box and all the Citus metadata is open and hackable gives us a lot of flexibility. The Postgres expertise in the Citus team is also a big attraction and has made Citus a one-stop shop for us.”

Jarred Nicholls, Chief Software Architect at IronNet Cybersecurity

So here’s to the new SaaS database flywheel, starring Postgres and Citus

Decades ago, on-prem enterprise software had an outsize impact on the fortunes of the competing database vendors. And today’s SaaS businesses are set to have equivalent influence over database technologies. Which is why I’m so excited about this SaaS database flywheel and the starring role that both Postgres and Citus Data get to play. Fun days ahead.

Citus Data founders

Left to right, Citus Data Founders: Ozgun Erdogan, CTO; Sumedh Pathak, VP Engineering; and Umur Cubukcu, CEO. Monterey, CA. 2017