Skip to content

Instantly share code, notes, and snippets.

@JakSprats
Created November 18, 2011 01:12
Show Gist options
  • Save JakSprats/1375201 to your computer and use it in GitHub Desktop.
Save JakSprats/1375201 to your computer and use it in GitHub Desktop.
Benchmarking AlchemyDB (TCP, UDS, Embedded)
# download
git clone git://github.com/JakSprats/Alchemy-Database.git
# make the package
cd Alchemy-Database; make;
# change to directory w/ server, client, & benchmark-tool
cd redis/src
# NOTE: the INFO command displays #keys, memory usage, etc...
./alchemy-cli INFO
# HELPER FUNCTIONS
function start_server() {
taskset -c 0 ./alchemy-server ../redis.conf
}
function kill_server() {
kill $(ps ax|grep alchemy-server |grep -v grep |cut -f 1 -d \ )
}
function start_server_no_save() {
rm dump.rdb; # Remove the previous RDB snapshot
taskset -c 0 ./alchemy-server ../redis_NO_SAVE.conf
}
function start_server_UDS_no_save() {
rm dump.rdb; # Remove the previous RDB snapshot
taskset -c 0 ./alchemy-server ../redis_UDS_NO_SAVE.conf
}
# NOTE: for client<->server 2 terminal windows should be used, one for client, one for server
# TEST ONE
# TERMINAL 1 -> start server on core 0 & turn SAVE OFF
start_server_no_save
# TERMINAL 2 -> SET 10M distinct KVs
NUM=10000000 # 10M
echo SET KV $NUM
time taskset -c 1 ./alchemy-gen-benchmark -c 200 -n $NUM -r $NUM -A OK -Q SET key_00000000000001 random_text_00000000000001
# results: 71263.69 requests per second
time ./alchemy-cli SAVE
./alchemy-cli INFO |grep used_memory_human
#results: used_memory_human:836.55M
# In TERMINAL 1, CTRL+C to stop server, then restart
# or from TERMINAL2 do a "kill_server"
# NOTE: log level must be NOTICE to get message "DB loaded from disk: 5.590 seconds"
start_server
# TEST TWO - TCP for redis commands
# TERMINAL 1 -> start server on core 0 & turn SAVE OFF
kill_server
start_server_no_save
# TERMINAL 2
NUM=1000000 # 1M
echo BENCHMARK $NUM values
taskset -c 1 ./alchemy-benchmark -c 200 -n $NUM -r $NUM
# TEST THREE - UnixDomainSockets for redis commands
# TERMINAL 1 -> start server on core 0 & turn SAVE OFF & use UDS /tmp/redis.sock
kill_server
start_server_UDS_no_save
# TERMINAL 2
NUM=1000000 # 1M
echo BENCHMARK $NUM values
taskset -c 1 ./alchemy-benchmark -c 200 -n $NUM -r $NUM -s /tmp/redis.sock
# TEST FOUR - single row compression
kill_server
start_server_no_save
# Relation table compression example
./alchemy-cli CREATE TABLE kv "(pk INT, val TEXT)"
./alchemy-cli INSERT INTO kv "(val)" VALUES "('Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. ')" "RETURN SIZE"
-> BYTES: ROW: 452
#NOTE: text is 557 Bytes, compression ratio of 23%
# TEST FIVE - 10M simple rows
./alchemy-cli DROP TABLE kv
./alchemy-cli CREATE TABLE kv "(pk INT, val TEXT)"
NUM=10000000 # 10M rows
echo INSERT $NUM ROWS
time taskset -c 1 ./alchemy-gen-benchmark -c 200 -n $NUM -r $NUM -A INT -Q INSERT INTO kv "(val)" VALUES "('random_text_00000000000001')"
# results: 57146.79 requests per second
./alchemy-cli INFO |grep used_memory_human
# results: used_memory_human:1.20G
# NOTE: this type of table [INT,TEXT] is best stored as KV unless the compression ratio is high
# TEST FIVE - embedded tests
taskset -c 0 ./embedded_benchmark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment