October 29, 2024
At Prisma, we believe that deploying a database should be as simple as adding a new page in Notion. Today, we are excited to share the first milestone towards this vision: Prisma Postgres® gives developers analways-on database withpay-as-you-go pricing — thanks to our unique architecture design.Try it now!
We are excited to announce Prisma Postgres,a managed PostgreSQL service that gives developers analways-on database withpay-as-you-go pricing for storage and queries (no fixed cost, no cost for compute). It's like a serverless database — but without cold starts and a generous free tier!
To build a service with these capabilities, we've designed a unique architecture using bare metal machines, a revolutionary millisecond cloud stack, andunikernels (think: "hyper-specialized operating systems") running as ultra-lightweight microVMs.
Thanks to the first-class integration of Prisma products,Prisma Postgres comes with connection pooling, caching, and query optimization recommendations out-of-the-box.
Prisma Postgres is now available in Early Access 🎉
Our new architecture takes a fundamentally different approach to provisioning databases compared to existing cloud providers and other serverless database products. In this section, we'll take a look at the trend of serverless databases and explain how Prisma Postgres fits into this category. Jump ahead to thenext section if you care more about our architecture and technical details.
Serverless databases (like AWS Aurora Serverless, Azure Cosmos DB, Neon, or Turso) follow a similar model to their counterparts in serverless compute: Their main promise is to free developers from managing database infrastructure while providing a cost-efficient "pay-as-you-go" pricing model.
When using serverless databases, developers don't need to think about provisioning resources (like storage or compute), as the database auto-scales according to the application's needs.
The promise of auto-scaling often means that a database can scale down to zero, i.e., it'ssuspended. This can lead to high query latencies and poor user experience when the database needs to be "woken up" after inactivity, for example:
Some database providers even require manual action from developers to wake a suspended database. While serverless databases have their advantages, cold starts are a major drawback!
Free tiers are essential for developers to explore a database service, build hobby applications, and create proof-of-concepts.
However, in recent years, offering free tiers has become a significant challenge for database providers. Due to technology designs that often rely on reselling infrastructure from major providers like AWS or require costly, resource-intensive container-based systems, these providers struggle to sustain viable free tiers.
Prisma Postgres®: Building a Modern PostgreSQL Service Using Unikernels & MicroVMs
This difficulty has led companies likePlanetScale andHeroku to discontinue their free tier offerings entirely.
What if you could get all the benefits of "serverless" without the drawbacks, like limited free tiers and cold starts? We are making this vision a reality by building a managed PostgreSQL service from the ground up.
Today, we are thrilled to share the first step in this direction: We've teamed up withUnikraft to provision PostgreSQL instances usingUnikraft Cloud, a groundbreaking millisecond cloud platform that eliminates cold starts, enables millisecond scale-to-zero and auto-scale, and allows for thousands of instances to run on a single bare metal machine.
Cold starts are a real pain. Unikraft Cloud provides cold starts in the order of a few milliseconds with hardware-level isolation.
This unique architecture not only eliminates cold starts but also offers superior economics by supporting thousands of databases on a single machine. This approach allows us to create a generous free tier that other database providers simply cannot afford.
Read on to learn about the technical details of our new PostgreSQL service!
Modern PostgreSQL providers typically rely on either of two approaches to provision database infrastructure:
Prisma Postgres is neither. Instead, it uses Unikraft Cloud and is based on a new and unique architecture that delivers unmatched efficiency, safety (via strong, hardware-level isolation), speed, and developer experience when working with databases.
Let's take a closer look at Unikraft Cloud's millisecond cloud infrastructure:
To provide high efficiency and millisecond semantics, the Unikraft team had to optimize network components, cloud stack and application start time. Here's a quick overview of Unikraft Cloud'score components from the diagram above:
We are building Prisma Postgres from first principles, striking the perfect balance between performance, cost, safety, and ease of use.
To havefull control and avoid the limitations, constraints, and pricing models of major cloud providers, we chose to lease our own physical machines in data centers around the globe.
Prisma Postgres is based on the observation thatmodern hardware is incredibly powerful and cheap which was recently promoted by Basecamp:
Leaving the cloud will save us $7 million over five years.
In short: With Prisma Postgres, your database will run on powerful servers backed by high CPU core counts, large amounts of RAM, and super-fast NVME storage.
One of the core components of our architecture is the deployment of PostgreSQL insideunikernels running as lightweight microVMs.
Unikernels are famous for providing excellent performance in terms of boot times, throughput and memory consumption, to name a few metrics.
Unikraft: Fast, Specialized Unikernels the Easy Way (Research paper, EuroSys 21)
Over the past few months, we've collaborated closely with the Unikraft team and have been deeply impressed by their work of increasing DX and making unikernels more approachable for developers. Our conclusion is clear:Unikernels are finally ready to be adopted for high-performance production workloads.
Unikraft Cloud, which uses unikernels as one of its core components, provides the fastest, most economical, and safest way to deploy cloud-native applications:
Through an extra compilation step, Unikraft turns a traditional fullstack application container into a unikernel binary image that includes only the resources needed to run it — think: aspecialized operating system tailored to the needs of each particular application:
We've created the Prisma Postgres unikernel binary image in close collaboration with the Unikraft team. Here's the diagram of the Unikraft compilation process from before — but specialized for Prisma Postgres:
The Unikraft team managed to trim the original PostgreSQL image down from 280MB to 61MB. Here's a breakdown of the components of thePrisma Postgres image:
We reduced the image to about 20% of its original size by identifying and removing unnecessary packages from our deployment. The original PostgreSQL image includes a lot of generic functionality that isn't needed for Prisma Postgres.
In our architecture, these specialized binary images are deployed as unikernels on our bare metal machines; and, as unikernels are ultimately virtual machines, each PostgreSQL instance provides strong, hardware-level isolation.
Thanks to unikraft, a single machine can host thousands of application (in our case: Prisma Postgres) instances:
Standard virtual machines (VMs), containers, and unikernels offer different approaches to creatingvirtual environments on hardware.
Unikernels take a first-principles approach to cloud deployment. In the cloud, arguably only two things matter:
Everything in between the two is overhead. A unikernel adds the thinnest possible layer of software between the two such that the application can run on the hypervisor with the highest efficiency:
Here's a summary of the advantages unikernels have in comparison to standard VMs and containers:
Unikraft's mission is to "enable developers to create a specialized OS for every single application to ensure the best performance, security guarantees, and desired KPIs."
For us at Prisma, this means the machines with your PostgreSQL instances arespecialized for running PostgreSQL. This is in contrast to running PostgreSQL on ageneral-purpose operating system, which consumes resources that are not relevant to the application (i.e., PostgreSQL).
Our architecture enables us to avoid cold starts while providing all the benefits of serverless products. This is achieved through the lightweight design of the individual components:
Prisma Postgres is a major step towards our vision of providing a fully integrated data layer for global applications.
Our suite of Prisma products ensures you canbuild, fortify, and grow data-driven applications without worrying about data modeling, migrations, querying, or complex and expensive infrastructure (like Redis or Apache Kafka):
Here's an overview of what you get with Prisma:
The fastest way to try Prisma Postgres is by following the instructions here:
After setting up the database, you will receive instructions for downloading and running a sample project.
Prisma Postgres is launching in Early Access today. During the Early Access phase, production use is not recommended and there are a few things to know:
Also check out thedocumentation to learn about current limitations of Prisma Postgres.
Prisma Postgres offers fast boot times, low resource overhead, high security through isolation, and auto-scalability — all while being the PostgreSQL database you know and love.
Today marks the initial release of Prisma Postgres. Look forward to the General Availability release early next year!
We hope you're as excited as we are about this addition to the Prisma family. Try it out and let us know what you think onX and ourDiscord!
Note: Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission
Sign up for the Prisma Newsletter