CompanySeptember 15, 2021

Serverless Storage for Your Node.js Functions with Astra DB

Pieter Humphrey
Pieter HumphreyDevelopers
Serverless Storage for Your Node.js Functions with Astra DB

Learn more about Functions-as-service (FaaS), Astra DB, and Node.js on the upcoming Livestream with Alex Ellis, OpenFaaS, and Stefano Lottini from DataStax! 

When: Thursday, September 16th at 4:00 p.m. BST//11:00 a.m. EDT/8:00 a.m. PDT.

To get the most out of the live event, be sure to check out the OpenFaaS blog first! 

Did you ever wish you had persistent storage for your serverless functions? Storage that was as easy as an idiomatic API call in your favorite language? What if you could even handle JSON data with no upfront schema definition? Functions as a service (FaaS) are excellent containers for business logic. With functions, you can: 

  • Run backend code without managing any infrastructure whatsoever.
  • Run short-lived code that starts FaaST, runs and shuts down when complete or unused.
  • Run your code in a specific framework or library of your choice.
  • Trigger a function based on events that are defined by the FaaS provider.

That’s great, but what happens to the application state? Yes, you could run an in-process cache, session store, or use the modest filesystem allocated to the function. But these workarounds will be as short-lived as the function, so it’s not what most people consider persistent storage. 

Using APIs and or Drivers, you can get data out from your functions and into a database, but not many databases employ data API gateways or offer easy ways to surface a fluent data access layer in APIs like REST or GraphQL. Perhaps you have JSON data and you simply want a document-style NoSQL option that skips defining the schema upfront – just JSON and go.

So let’s assume getting to your database is easy with APIs, drivers, and schemaless JSON for a moment. Why then, would a serverless, autoscaling database be the preferred choice for persistent storage for your serverless, autoscaling functions? First off, it’s important to understand that serverless and FaaS are not quite the same thing. The key thing that makes FaaS and Serverless DBaaS so great together is autoscaling.

If you've invested in DBaaS and FaaS, you're probably not interested in managing infrastructure. Running serverless functions that have the potential to autoscale up rapidly is dangerous if connected directly to a back-end database that cannot auto-scale. 

Scaling up the application dynamically could put an unpredictable and increasing load on a data service or database that doesn’t use a similar (auto) scaling mechanism. The industry spent years trying to solve this problem in the application server era with connection pools and database connection conservation techniques. Most of those techniques are antithetical to FaaST-startup-and-terminate style serverless functions because there’s no connection to preserve!

Pairing an autoscaling application tier to a data tier that doesn’t autoscale drags down a system that could have otherwise been fully automated. Manually running a terraform script, or worse, waiting for an operations ticket to be created and serviced for scaling the database instance up or down would kill 50% of the automation value between application (function) and database. No Bueno.

So how can we wire together an autoscaling DBaaS like DataStax Astra DB, with serverless functions without having to write a ton of REST services to expose the database functions you need? Let us show you how!

Join Alex Ellis and Stefano Lottini from DataStax on a Livestream this Thursday, September 16th at 4:00 p.m. BST//11:00 a.m. EDT/8:00 a.m. PDT to learn how to pair FaaS with a serverless, autoscaling DBaaS for end-to-end automated scaling. Alex and Stefano will be ready to take your questions live and cover a number of different use cases! 

Subscribe & remind 👇

Join the Livestream:

Learn More:

Follow the DataStax Tech Blog for more developer stories. Check out our YouTube channel for tutorials and here for DataStax Developers on Twitter for the latest news about our developer community.


One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.