Abstract
Database-backed applications are nearly ubiquitous in our daily lives. Applications that make many small accesses to the database create two challenges for developers: increased latency and wasted resources from numerous network round trips. A well-known technique to improve transactional database application performance is to convert part of the application into stored procedures that are executed on the database server. Unfortunately, this conversion is often difficult. In this paper we describe Pyxis, a system that takes database-backed applications and automatically partitions their code into two pieces, one of which is executed on the application server and the other on the database server. Pyxis profiles the application and server loads, statically analyzes the code's dependencies, and produces a partitioning that minimizes the number of control transfers as well as the amount of data sent during each transfer. Our experiments using TPC-C and TPC-W show that Pyxis is able to generate partitions with up to 3x reduction in latency and 1.7x improvement in throughput when compared to a traditional non-partitioned implementation and has comparable performance to that of a custom stored procedure implementation.
Introduction
Most modern applications rely on a database, but the "chatter" between the application server and the database server is a major performance killer. Every SQL query involves a network round trip, adding milliseconds of latency that accumulate quickly. The industry-standard solution is to use stored procedures—logic that lives inside the database. However, stored procedures present significant challenges: they are often written in vendor-specific languages (like PL/SQL), creating fragmented codebases that are hard to maintain, and manually identifying logic for conversion is difficult and error-prone. Furthermore, hard-coded stored procedures lack flexibility; if a database server becomes overloaded, there is no easy way to shift logic back to the application server dynamically.
The Pyxis System
Pyxis aims to provide the performance benefits of stored procedures with the ease of writing standard, unified Java code. It employs a multi-stage pipeline to automate the partitioning process, as illustrated in the system architecture.
Static Dependency Analysis
At the core of Pyxis is a static analyzer that builds a Partition Graph. This is an augmented version of a Program Dependence Graph (PDG) that tracks how data and control flow between different statements. By using PDGs rather than standard Control Flow Graphs, Pyxis can reorder statements to create larger contiguous blocks of code for each server, significantly reducing the number of expensive "control transfers" (switches between servers).
Optimization and Runtime
The system combines static analysis with dynamic profiling to measure execution frequency and data transfer sizes. Pyxis then treats partitioning as a mathematical optimization problem using Integer Linear Programming (ILP). It seeks a "cut" in the partition graph that minimizes total cost (latency and bandwidth) while respecting a CPU budget for the database server.
The partitioned logic is converted into PyxIL, an intermediate language that handles distributed heap and stack management. The system automatically inserts synchronization operations to keep application state in sync as execution moves between servers. Notably, Pyxis can switch partitions at runtime; if the database server reports high CPU load, the runtime can shift logic back to the application server to prevent bottlenecks.
Evaluation and Results
The researchers evaluated Pyxis using industry-standard benchmarks: TPC-C (simulating order-entry) and TPC-W (simulating e-commerce).
In TPC-C tests, Pyxis-generated partitions matched the performance of hand-optimized stored procedures, providing a 3x reduction in latency and a 1.7x improvement in throughput over standard JDBC implementations. Microbenchmarks also confirmed that Pyxis successfully manages complex Java features like arrays and objects while maintaining a consistent distributed heap. Furthermore, the system demonstrated effective dynamic load balancing, shifting logic away from overloaded database servers to maintain lower latency than static manual splits.
Conclusion and Future Work
Pyxis demonstrates that automatic partitioning can bridge the gap between developer productivity and system performance. While the current implementation introduces a roughly 6x slowdown for local code execution due to runtime bookkeeping, this could be mitigated by targeting lower-level languages. Future work includes supporting shared-memory multithreading, improving synchronization strategies for large data objects, and extending the system to other languages and ORM frameworks like Hibernate.
Summary updated