Running Applications Inside the Database: MuduDB's Unified Code & Deployment Model
MuduDB proposes unifying application and database by compiling general-purpose language code to WASM for in-database execution, eliminating network round-trips and dual development while preserving developer tooling and database control over transactions and resources.
The Boundary Pain: Why Separating App and Database Costs Performance and Productivity
Modern databases have evolved far beyond storage engines; they include massive proprietary language systems. Oracle's SQL reference spans ~2,500 pages versus Java's <900-page spec, illustrating the scale of database-specific programming ecosystems. Developers naturally prefer familiar general-purpose languages with mature toolchains (frameworks, dependency management, debugging, deployment) over vendor-specific SQL dialects and procedural extensions. However, moving business logic out of the database incurs four concrete costs:
Network round-trip cost: Each SQL call crosses process or machine boundaries, accumulating latency.
Dual development cost: Logic is written once via ORM for development and again as stored procedures for optimization, risking behavioral inconsistency.
Transaction coordination cost: Business transactions span app and DB layers, requiring manual consistency coordination.
Deployment maintenance cost: Schema migrations, app binaries, and configs are delivered separately, complicating versioning, upgrades, and rollbacks.
Research confirms these pains. CIDR 2025 (Zhou, Leis, Yu, Stonebraker) shows OLTP systems suffer from communication overhead as hardware evolves; ErbiumDB (CIDR 2025 best paper) highlights the object-relational abstraction gap; MosaicDB (VLDB 2024) demonstrates stackless coroutines to hide multi-source access latency. The root cause: data and compute are split across different abstractions, runtimes, and delivery pipelines.
AI and New Hardware Open an Architectural Window
Two trends create an opportunity to rethink the boundary:
LLM-generated code: The BIRD benchmark (NeurIPS 2023) shows LLMs can generate complex queries. As code shifts from human-written to AI-generated, databases need machine-verifiable constraints on correctness, safety, and resource usage before execution.
Hardware evolution: Haas & Leis (VLDB 2023) find modern NVMe storage delivers up to 3.5× more performance than current software stacks can exploit, demanding redesigned I/O scheduling, execution models, and runtimes. MosaicDB's stackless coroutines align with this direction, enabling lightweight contexts and flexible scheduling to overlap I/O waits with computation.
These trends point to databases becoming runtime platforms that safely execute AI-generated code, fully utilize modern hardware, and unify data/compute scheduling.
Database = Storage + Compute + Deployment Unified Platform
MuduDB embraces general-purpose languages (Rust, JavaScript, C#) instead of inventing another DB-specific language. Developers write business logic in familiar languages; the toolchain compiles it to a unified intermediate representation (WASM components) that runs inside the database. Interactive SQL and stored procedures become two execution modes of the same code:
Development: Code runs as interactive transactions on the app side, enabling fast debugging/iteration with existing tooling.
Deployment: Same code is compiled to stored procedures executing inside the DB, eliminating cross-process/network overhead without rewriting.
MuduDB introduces versioned application packages ( .mpk) bundling schema, initial data, and business code into a single deployable artifact. This unifies delivery, versioning, upgrade, and rollback. Business logic and data access share a single transaction management and runtime scheduling system, so cross-layer coordination disappears — transactions complete within one boundary.
From User Code to Kernel Execution: A Controlled Boundary
MuduDB lets user code run in the kernel naturally:
Developers write synchronous, sequential logic in familiar languages — easier for humans and AI to understand, generate, and maintain.
During development, the same code calls the DB via interactive transactions for rapid iteration.
At deployment, the toolchain automatically translates synchronous code to asynchronous form and compiles to WASM components. The app invokes a stored procedure; the runtime executes the WASM in a controlled sandbox.
Crucially, user code does not gain raw kernel control. All DB resource access goes through a narrow, explicit system-call interface divided into four categories:
SQL operations: mudu_query, mudu_command, mudu_batch for queries, mutations, batch execution.
Key-value operations: mudu_get, mudu_put, mudu_range for basic KV access and range scans.
Session management: mudu_open, mudu_close for session lifecycle.
File operations: mudu_fs_* for controlled file resource access.
Unlike broad client-driver interfaces, this minimal syscall set establishes a clear, manageable execution boundary between general-purpose language code and the DB kernel. The kernel retains full authority over SQL execution plans, transaction management, I/O, and task scheduling. A smaller interface means easier safety verification and correctness guarantees.
The false dichotomy between interactive SQL and stored procedures is ending. With modern languages, WASM sandboxing, and new hardware, "moving compute to data" no longer sacrifices developer experience, ecosystem, or adds complexity — it becomes a natural, accessible choice. The future database is not just a data container but a platform that runs applications.
Source: DTCC 2026 talk "Database as Application Execution and Deployment Platform" by Guo Hua (scuptio founder). MuduDB: https://mududb.io/ GitHub: https://github.com/scuptio/mududb
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
