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.
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.
Key Architectural Features
- 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.
- 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%.
- 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