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 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 then 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 pages to not having to worry about your database
Several months ago, Craig Kerstiens (a colleague of mine at Citus Data) went out to lunch with a CTO of a SaaS company. After working their way through all the usual small talk, Craig asked the CTO how his experience had been with our Citus cloud database the past few months. Without missing a beat, the CTO turned to Craig and said he hadn’t even thought about his database since he’d finished migrating onto Citus Cloud.
For me, that was the ultimate compliment.
And it was a sweet validation that the cloud database company I’d decided to join earlier this year had something valuable for SaaS businesses.
The CTO had gone from the painful ring of 4:00am pages with his previous single-node 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.
Decision tree for SaaS databases — start relational, start with Postgres
SaaS businesses face a ton of 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.
Among the architectural decisions that are super important: which database to pick. Hence the decision tree 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?
Use technologies for the scale you’re at
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 — an early team member at Heroku and founder of Heroku’s Department of Data — 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
Catnip for SaaS businesses who love Postgres
If you’ve never heard of Citus, here’s a recap sequence to bring you up to speed.
Citus Cloud is a fully-managed database as a service that scales out Postgres.
Citus scales Postgres across multiple nodes, and distributes transactions and SQL queries across multiple nodes to get massive parallelism — as well as much bigger compute, memory, and disk resources for the database.
Citus is an extension to the open source Postgres database (not a fork.) So unlike the many other derivatives of Postgres that are forks, Citus stays current. In fact, Citus is already packaged and deployed with Postgres 10.1, the latest Postgres release that came out ~two weeks ago.
Because so many people at Citus were once part of the Heroku Postgres team, the Citus Cloud team has decades of collective experience managing millions of Postgres databases in the cloud. The Citus database as a service takes 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.
Tl;dr about the Citus Cloud 2 announcement
Earlier in November, the team at Citus announced a pretty awesome update to Citus Cloud: Citus Cloud 2, Postgres, and scaling out without sacrifice.
The Citus announcement was all about enabling developers to scale out your apps without having to worry about your database — replete with cloud database features like:
- Citus Warp for migration (such as migration from RDS Postgres over to Citus);
- Followers aka read-only replicas;
- Point-in-time recovery (for a distributed database);
- Forks to create (distributed!) 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 most of all I loved what users and customers said, such as the CTO of ProsperWorks:
“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
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 SaaS developers who think a relational database like Postgres is the right fit for their application.
(Not the mechanical flywheel, but the business flywheel: 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 need (and choose) Citus.
- As more developers choose Citus, more people will learn about Citus.
- As more developers learn about Citus, more developers will pick Postgres, knowing they will have a way to scale out when their SaaS application becomes an overnight success.
You no longer have to give up Postgres when your SaaS application becomes an overnight success
Because of Citus, Postgres is not only the right short-term choice for SaaS businesses, but also the ideal long-term choice for SaaS applications.
Why? You no longer have to give up Postgres when your app starts to hit the limits on single-node Postgres. Rather than have to re-architect for NoSQL, or re-architect to shard the application, you have a new choice.
“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
As someone who works at Citus and with SaaS customers, I’m super excited about this SaaS database flywheel and the starring role that both Postgres and Citus Data get to play in helping today’s SaaS businesses grow.
If you’re kickstarting a new SaaS business, my advice: start with Postgres, ideally in the cloud.
And when you’re growing like gangbusters and need to scale out, don’t divert developers from your core app to manually shard your application. Don’t re-architect your app to go to NoSQL. Instead, let Citus Data make sharding simple.
You can follow me on Twitter here.