This repository contains code implementing DeToX, a transactional caching system, for our OSDI '23 paper. DeToX leverages insights on transactional hit rate to improve caching performance for transactional workloads.
In addition to DeToX, this repository contains:
- A modified version of ChronoCache, a middleware predictive query caching system, that measures transactional hit rate, integrates with Redis, and supports several benchmarks not available for the original system.
- A modified version of Redis that supports several eviction algorithms, including DeToX's eviction algorithm and LIFE from the PACMan paper.
- A caching simulator that takes transaction traces as input and outputs hit rates for the offline Belady and Transactional Belady algorithms.
This repository is structured as follows:
- /chronocache - the codebase for ChronoCache
- /oltpbench-chronocache - the benchmarks for ChronoCache
- /redis - the modified version of Redis supporting transactional caching algorithms
- /simulator - the caching simulator for offline policies
- /sys - the transactional caching system
- /benchmarks - the benchmarks for running DeToX
- /src - the implementation of the DeToX shim layer
Prerequisites:
- mvn 3.8.5
- build-essential
- Java 17
Note: if running on EC2 or other cloud providers, make sure security groups / firewalls allow all traffic.
DeToX supports a range of benchmarks and systems. Currently, the default caching system is Redis and the default database is Postgres. There is separate loader and runner for every benchmark.
To run DeToX on a benchmark:
-
cd sys
-
mvn clean install
-
mvn assembly:single
-
Configure benchmark client:
____ExpConfig.json
-
threads
: number of benchmark threads -
req_threads_per_bm_thread
: thread pool size for each benchmark thread’s requests; a single benchmark thread may run multiple requests in parallel using its own thread pool -
exp_length
: experiment length in seconds -
postgres_hostname
: where postgres is hosted -
redis_hostname
: where redis cache is hosted -
redis_enabled
: enables redis cache. otherwise, only uses postgres. Should be false while loading! -
redis_prefetch
: enables prefetching to redis; requires redis_enabled to be true.
-
-
To run loader and benchmark client:
java -jar ___.jar ___ExpConfig.json
Note: to build a different jar, edit pom.xml
plugin.
DeToX must be run with a database. Postgres is one of the supported systems.
To install and run Postgres:
-
sudo apt install postgresql
-
sudo systemctl start postgresql.service
-
sudo -u postgres psql
-
In
psql: CREATE USER admin WITH PASSWORD 'password';
-
In
psql: CREATE DATABASE benchmark;
-
Edit
/etc/postgresql/12/main/pg_hba.conf
; change the line under IPv4 local connections to use 0.0.0.0/0 instead of 127.0.0.1/32 (allows connections from Internet clients) -
sudo systemctl restart postgresql.service
For caching, DeToX currently integrates with Redis. We add DeToX, GDSF, and LIFE to Redis. The main changes are in config.c
, db.c
, evict.c
, object.c
, server.h
, and t_string.c
in the src/
directory. We modify the mget
function to process parallel reads.
To run Redis:
-
cd redis, make
-
Configuring Redis:
redis.conf
-
maxmemory: cache size
-
maxmemory-policy: gdsf, min-fsl, avg-fsl, etc.
-
maxmemory-samples: number of samples to choose eviction candidate from
-
-
Run with
redis ./src/redis-server redis.conf
Note: use rm dump.rdb
to clear the cache.
ChronoCache accepts query submissions via a REST interface. To start up ChronoCache's REST interface, use:
-
Set configuration parameters in
Parameters.java
andchronocache.properties
. -
Run
mvn jetty:run -DskipTests
All benchmarks for ChronoCache should be run via the modified version of OLTPBench available in the /oltpbench-chronocache
folder.