Fauna logo
Product
Solutions
Pricing
Resources
Company
Log InGet a DemoSign Up
Fauna logo
Pricing
Customers
Sign Up
© 2022 Fauna, Inc. All Rights Reserved.
NEW
serverless

Introduction to serverless databases

Segun Saka-Aiyedun|May 12th, 2022|

Categories:

Serverless
Serverless is a new paradigm in which servers operate on a more automated level, freeing developers from the time and effort of managing them. This is an advantage when it comes to development because developers and engineers don’t need to handle as much in terms of infrastructure, which can be time-consuming and expensive if you don't have the necessary in-house expertise.
Similarly, a serverless database takes the features of a traditional database and combines them with the values and flexibility of a serverless architecture. Working with a serverless database reduces much of the complexity of a database into a simple cloud-based API. It can provide an organization with more automated scaling, stronger resilience, and reduced time to market.
In this guide, you’ll learn what a serverless database is and how it works, as well as more about the benefits it can offer to your organization.

What is a serverless database?

A serverless database is any database that grows automatically to meet the changing demands of an application and manages unexpected workloads that cannot be predicted or scheduled.
The benefits of serverless computing include only paying for the resources you use, scaling up and down to match demand, eliminating the need to manage servers, and lowering costs. If you use a non-serverless database in a serverless computing architecture, you lose these advantages. The major feature of a serverless database is its ability to adjust capacity based on its workload.
A serverless database works when and wherever it is needed. A service provider will manage the database for you, including the provisioning of instances or clusters.

Why should you use a serverless database?

A serverless database enables developers to work on projects without needing a specialized hardware platform or needing to worry about getting necessary resources for their applications.
When you use a serverless database, you avoid several problems associated with a traditional setup. You save on costs because you only pay for what you use, and you save time because you don’t have to spend it patching, provisioning, and managing servers. A serverless database also improves security by ensuring that all applications interacting with the same data set pass the same access control, thus reducing the attack surface.
A serverless database can be used for prototype testing, automatic website scaling, and continuous integration/continuous deployment (CI/CD) practices.
There are several key features of a serverless database:
  • Automatic elastic scaling and geographical distribution: You don’t have to worry about sharding or whether your database can handle a sudden spike in traffic, because a serverless database scales up and down automatically to meet demand. This means scaling all the way down to zero when the database isn't being utilized while promptly responding when a query arrives. A serverless database can also scale geographically, moving and storing data dynamically around the globe to minimize latency and give users worldwide a consistently fast experience.
  • Native resilience and fault tolerance: You also won’t have to worry about faulty storage nodes or zone disruptions bringing your services down. A serverless database can survive node and zone outages, as well as implement software updates and online schema changes, without any planned downtime required.
  • Simplicity and familiarity: Working with your database is as simple and intuitive as using an API. With features such as self-service starts, completely managed operations, and the ability to create clusters with the press of a button or a single command, a serverless database makes life simpler for everyone who works with it.
  • Consumption-based billing: You don’t pay for storage and compute resources you’re not using. A serverless database only bills you for resources you used, and you can set spending limits so that you don’t overrun your budget.
  • ACID: You don’t have to sacrifice consistency for scale. Some serverless databases like Fauna provide the needed atomicity, consistency, isolation, and durability (ACID) properties to your transactions without sacrificing speed, no matter what scale you’re operating at.
Serverless databases are ideal for smaller businesses because they don’t require much maintenance, infrastructure support, or labor time. They work well for the following use cases:
  • Prototyping and testing: With increasing competition across all industries, it is critical to produce prototypes and gather meaningful feedback from users as soon as possible. Since serverless database features such as self-serve, speed, and pay-per-use billing are both economical and relatively fast to implement, you can focus on writing code and responding to user feedback in the testing environment.
  • Reduced time to market: Serverless databases can help you drastically reduce time to market. Instead of performing complex deployment procedures to push out bug patches and new features, you can add and alter code as needed.
  • Automatic scaling: A serverless database can be utilized with existing or new applications that have unpredictably high database demand; it automatically scales up when needed and down when not. You don’t need to spend time configuring an autoscaling policy for your database system.
  • Managing resource demands: With a serverless database, you don’t have to worry about allocating enough resources to fulfill inconsistent resource requests. A serverless database will expand automatically when needed.

    Examples of serverless databases

  • Amazon Aurora Serverless is a proprietary service from AWS that’s compatible with Postgres and MySQL, which means you can connect to your Aurora database as if you’re connecting to Postgres or MySQL. It is also AWS cloud optimized. Aurora storage automatically grows in increments of 10 GB, up to 64 TB.
  • Google Firestore is a serverless document database that provides direct database access for web, IoT, and mobile app development. It’s highly scalable with no maintenance window and zero downtime. Firestore enables offline data access for web and mobile SDKs, enables ACID-compliant transactions, supports multiple server-side development libraries and programming languages, enables data validation and identity-based security access controls, and offers real-time data synchronization with offline data access.
  • Amazon DynamoDB is a NoSQL database service with single-digit millisecond response times. AWS manages everything, allowing you to store as much data as you need while also handling unpredictable demands. It's also a fully managed NoSQL database service with built-in scalability.
  • CockroachDB, an SQL relational serverless database, is considered one of the most evolved serverless databases. It offers a completely elastic and robust data architecture, distributed globally to help developers rapidly develop apps at a low cost. It is a single Postgres instance in many aspects.
  • Fauna is a versatile transactional database that’s supplied as a secure, scalable cloud API with native GraphQL. Fauna blends the flexibility of NoSQL systems with SQL databases’ relational querying and transactional capabilities. It supports drivers for languages including Python, Java, Scala, and GraphQL, and promises full ACID compliance.

How does a serverless database work?

For an example of a serverless database, look at Fauna. It offers on-demand autoscaling, which means that the database starts up, grows capacity based on the demand of your application, and shuts down when not in use.
Fauna is a multi-model database with a data API for client-serverless applications. Its semi-structured data model supports relational, document, object-oriented, and graph data.
Fauna is also a NoSQL database, which means you can’t use SQL to access it. Instead, your primary interface is the Fauna Query Language (FQL). FQL is not a general-purpose programming language, but it allows for advanced data processing and retrieval from Fauna. All functions, control structures, and literals return values in the language, which is expression-oriented. This makes it simple to combine results into an array or object, or to map over a collection and calculate a result for each member of your team.
You run a query by sending it to a Fauna cluster, which computes and provides the results. Query execution is transactional, which means that if anything goes wrong, no changes are committed. If a query fails, you get an error rather than a result.
Fauna’s serverless database design is multi-tenant, unlike the single-tenant design of a traditional database. In a single-tenant architecture, you pay for the server’s entire storage and processing capabilities even if you only utilize a tiny piece of it. In a multi-tenant architecture, you share that server with other users and only pay for the database storage that you use, which helps to decrease costs. Many database systems enable multi-tenancy, but Fauna goes a step further by allowing every database to have numerous offspring databases. This means you can administer a single large Fauna cluster, build some top-level databases, and grant teams complete administrative access to those databases. You can establish as many databases as you need without requiring an operator’s assistance.
Data protection and security safeguards are a crucial aspect of serverless databases. In Fauna, security is implemented at the API level with access keys to authenticate connections. This access key mechanism applies to both administrator and server-level connections, as well as to object and user-level connections.

What are the benefits of serverless databases?

  • Cost-effectiveness and high scalability: You will save time and money by using a serverless database, which eliminates the need for a license, installation, cabling, configuration, maintenance, and support. Scaling computing systems do not need to be set up manually by operators or developers. Furthermore, you can use resources to construct apps in the most efficient way possible based on your needs.
  • Better resilience and availability: A serverless database is duplicated across multiple regions, so if a storage node fails, all queries will be diverted to other nodes with load balancers until the node recovers, making it resilient and highly available. A serverless system is more adaptable than a traditional system in general. Serverless databases enable you to reduce latency, and data from event-driven functions is read where it is closest to the user.
  • Increased productivity and better developer experience (DX): Developers don't have to worry about provisioning, configuring, or managing database infrastructure while using a serverless database. Developers just need to concentrate on creating applications, which increases productivity and provides a better DX.

Conclusion

Serverless databases can be a real asset to developer teams. They can increase your compute speed and resilience while decreasing the amount of time and money you spend on resources and scaling. Implementing a serverless database can vastly improve the DX at your organization.
If you’re looking at options for a serverless database, consider Fauna. The transactional database uses a cloud API to provide simple, intuitive access to your data. It supports real-time streaming and GraphQL, and you can scale it globally as needed. To see how Fauna can help you, sign up for a free account.

If you enjoyed our blog, and want to work on systems and challenges related to globally distributed systems, serverless databases, GraphQL, and Jamstack, Fauna is hiring!

Share this post

TWITTERLINKEDIN
‹︁ PreviousNext ›︁

Subscribe to Fauna's newsletter

Get latest blog posts, development tips & tricks, and latest learning material delivered right to your inbox.