NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Apiary: A DBMS-Backed Transactional Function-as-a-Service Framework

Peter Kraft, Qian Li, Kostis Kaffes, Athinagoras Skiadopoulos, Deeptaanshu Kumar, Danny Cho, Jason Li, Robert Redmond, Nathan W. Weckwerth, Brian S. Xia, Peter Bailis, Michael J. Cafarella, Goetz Graefe, Jeremy Kepner, Christos Kozyrakis, Michael Stonebraker, Lalith Suresh, Xiangyao Yu, Matei ZahariaarXiv 2022 · DOI

TL;DR

Apiary is a new serverless (FaaS) framework that eliminates the performance-killing gap between "stateless" functions and remote databases. By embedding function execution directly into a distributed DBMS as stored procedures, Apiary achieves up to a 68× speedup over traditional platforms while providing industrial-strength ACID transactions and "exactly-once" execution guarantees.

The Problem: The Data-Compute Gap

Modern Function-as-a-Service (FaaS) platforms like AWS Lambda offer excellent scalability but are notoriously inefficient for data-centric applications, such as e-commerce or social media backends. This inefficiency stems from the physical and logical separation of compute and data.

In a standard FaaS setup, every data read or write requires a network call to a remote database. Our research indicates that in many environments, up to 98% of a function's execution time is spent waiting on communication rather than performing logic.

Execution time breakdown for common microservice benchmarks, highlighting the dominance of service-to-database communication overhead.

Furthermore, providing transactional guarantees—ensuring a series of steps either all succeed or all fail—is exceptionally difficult when the "brain" (the function) and the "memory" (the database) are disconnected.

The Apiary Solution: DBMS-Integration

The core innovation of Apiary is the co-location of compute and data. Instead of functions calling a database, the functions live inside the database.

Comparison of traditional FaaS platforms (left) versus the integrated Apiary approach (right), where functions are co-located with the data.

Key Architectural Features

  1. Co-location: Apiary wraps a distributed DBMS (specifically VoltDB) and uses it as a unified runtime. Functions are compiled into stored procedures, which run natively as ACID transactions.
  2. Selective Function Recording (SFR): To ensure "exactly-once" semantics without the performance penalty of logging every output to disk, Apiary uses a novel SFR algorithm. By using static analysis to identify the minimum number of functions that must be recorded, Apiary reduces logging overhead from 120% to less than 5%.
  3. Integrated Tracing: Because the platform manages both code and data, it automatically tracks "provenance"—exactly which function modified which row of data—with minimal performance impact (<15% overhead).

Evaluation and Results

We evaluated Apiary using three industry-standard microservice benchmarks: Shop (e-commerce), Hotel (reservations), and Retwis (social network).

  • Massive Speedups: Apiary outperformed OpenWhisk by 7–68× and state-of-the-art research systems like Cloudburst and Boki by 2–27×.
  • Scalability: The system scales linearly, handling over 1.2 Million Requests Per Second (RPS) for the Shop workload when scaled to 40 database servers.
  • Cost Efficiency: At high loads, Apiary is significantly cheaper than a combination of Google Cloud Functions and Firestore due to its higher resource efficiency.
  • Fault Tolerance: The SFR algorithm allows the system to recover from failures and resume workflows exactly where they left off, eliminating the "double-execution" risks common in other platforms.

Limitations and Future Work

Apiary is specifically designed for data-centric tasks involving short-lived, high-frequency transactions. It is not intended for compute-heavy tasks like video encoding. Currently, Apiary supports relational (SQL-like) data models; extending these concepts to NoSQL and further optimizing multi-partition transactions remain goals for future research.

Summary updated

BibTeX
@misc{kraft2022apiary,
  author = {Peter Kraft and Qian Li and Kostis Kaffes and Athinagoras Skiadopoulos and Deeptaanshu Kumar and Danny Cho and Jason Li and Robert Redmond and Nathan W. Weckwerth and Brian S. Xia and Peter Bailis and Michael J. Cafarella and Goetz Graefe and Jeremy Kepner and Christos Kozyrakis and Michael Stonebraker and Lalith Suresh and Xiangyao Yu and Matei Zaharia},
  title = {{Apiary: A DBMS-Backed Transactional Function-as-a-Service Framework}},
  year = {2022},
  eprint = {2208.13068},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.13068},
}
Figure