Skip to content

Commit

Permalink
examples: add latency examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdroychan committed Jul 29, 2024
1 parent 4bcaae6 commit e827079
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 0 deletions.
12 changes: 12 additions & 0 deletions examples/latency/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
This example shows the latency measurement of the [writeheavy](../writeheavy/)
and [readpopular](../readpopular/) examples. Their descriptions can be found in their own
directories.

5950X CPU 0-15 results (writeheavy, [pdf](latency-writeheavy.pdf)):

![latency-writeheavy](latency-writeheavy.png)


5950X CPU 0-15 results (readpopular, [pdf](latency-readpopular.pdf)):

![latency-readpopular](latency-readpopular.png)
Binary file added examples/latency/latency-readpopular.pdf
Binary file not shown.
Binary file added examples/latency/latency-readpopular.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/latency/latency-writeheavy.pdf
Binary file not shown.
Binary file added examples/latency/latency-writeheavy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions examples/latency/plot.gpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
set terminal pdf size 10,3
set xlabel "Threads"
set key left top

set output "latency-writeheavy.pdf"
set multiplot layout 1,3
set ylabel "Average Latency (ns)"
plot [0:17] [0:] \
"chashmap-writeheavy.txt" using 2:20 with lp ti "chashmap",\
"contrie-writeheavy.txt" using 2:20 with lp ti "contrie",\
"dashmap-writeheavy.txt" using 2:20 with lp ti "dashmap",\
"flurry-writeheavy.txt" using 2:20 with lp ti "flurry",\
"papaya-writeheavy.txt" using 2:20 with lp ti "papaya",\
"scchashmap-writeheavy.txt" using 2:20 with lp ti "scchashmap",\
"mutex_hashmap-writeheavy.txt" using 2:20 with lp ti "mutexhashmap",\
"rwlock_hashmap-writeheavy.txt" using 2:20 with lp ti "rwlockhashmap"

set ylabel "P99 Latency (ns)"
plot [0:17] [0:] \
"chashmap-writeheavy.txt" using 2:26 with lp ti "chashmap",\
"contrie-writeheavy.txt" using 2:26 with lp ti "contrie",\
"dashmap-writeheavy.txt" using 2:26 with lp ti "dashmap",\
"flurry-writeheavy.txt" using 2:26 with lp ti "flurry",\
"papaya-writeheavy.txt" using 2:26 with lp ti "papaya",\
"scchashmap-writeheavy.txt" using 2:26 with lp ti "scchashmap",\
"mutex_hashmap-writeheavy.txt" using 2:26 with lp ti "mutexhashmap",\
"rwlock_hashmap-writeheavy.txt" using 2:26 with lp ti "rwlockhashmap"

set ylabel "P999 Latency (ns)"
plot [0:17] [0:] \
"chashmap-writeheavy.txt" using 2:28 with lp ti "chashmap",\
"contrie-writeheavy.txt" using 2:28 with lp ti "contrie",\
"dashmap-writeheavy.txt" using 2:28 with lp ti "dashmap",\
"flurry-writeheavy.txt" using 2:28 with lp ti "flurry",\
"papaya-writeheavy.txt" using 2:28 with lp ti "papaya",\
"scchashmap-writeheavy.txt" using 2:28 with lp ti "scchashmap",\
"mutex_hashmap-writeheavy.txt" using 2:28 with lp ti "mutexhashmap",\
"rwlock_hashmap-writeheavy.txt" using 2:28 with lp ti "rwlockhashmap"

unset multiplot
set output "latency-readpopular.pdf"
set multiplot layout 1,3
set ylabel "Average Latency (ns)"
plot [0:17] [0:] \
"chashmap-readpopular.txt" using 2:20 with lp ti "chashmap",\
"contrie-readpopular.txt" using 2:20 with lp ti "contrie",\
"dashmap-readpopular.txt" using 2:20 with lp ti "dashmap",\
"flurry-readpopular.txt" using 2:20 with lp ti "flurry",\
"papaya-readpopular.txt" using 2:20 with lp ti "papaya",\
"scchashmap-readpopular.txt" using 2:20 with lp ti "scchashmap",\
"mutex_hashmap-readpopular.txt" using 2:20 with lp ti "mutexhashmap",\
"rwlock_hashmap-readpopular.txt" using 2:20 with lp ti "rwlockhashmap"

set ylabel "P99 Latency (ns)"
plot [0:17] [0:] \
"chashmap-readpopular.txt" using 2:26 with lp ti "chashmap",\
"contrie-readpopular.txt" using 2:26 with lp ti "contrie",\
"dashmap-readpopular.txt" using 2:26 with lp ti "dashmap",\
"flurry-readpopular.txt" using 2:26 with lp ti "flurry",\
"papaya-readpopular.txt" using 2:26 with lp ti "papaya",\
"scchashmap-readpopular.txt" using 2:26 with lp ti "scchashmap",\
"mutex_hashmap-readpopular.txt" using 2:26 with lp ti "mutexhashmap",\
"rwlock_hashmap-readpopular.txt" using 2:26 with lp ti "rwlockhashmap"

set ylabel "P999 Latency (ns)"
plot [0:17] [0:] \
"chashmap-readpopular.txt" using 2:28 with lp ti "chashmap",\
"contrie-readpopular.txt" using 2:28 with lp ti "contrie",\
"dashmap-readpopular.txt" using 2:28 with lp ti "dashmap",\
"flurry-readpopular.txt" using 2:28 with lp ti "flurry",\
"papaya-readpopular.txt" using 2:28 with lp ti "papaya",\
"scchashmap-readpopular.txt" using 2:28 with lp ti "scchashmap",\
"mutex_hashmap-readpopular.txt" using 2:28 with lp ti "mutexhashmap",\
"rwlock_hashmap-readpopular.txt" using 2:28 with lp ti "rwlockhashmap"
23 changes: 23 additions & 0 deletions examples/latency/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

cargo +stable build --profile release-lto --all-features

STORE_DIR=$DIR/../../presets/stores

STORES="chashmap contrie dashmap flurry papaya scchashmap mutex_hashmap rwlock_hashmap"

for s in $STORES; do
for b in readpopular writeheavy; do
benchmark=$DIR/../$b/$b.toml
echo $s-$b
rm $s-$b.txt 2>/dev/null
for t in `seq 1 16`; do
data="$(env global.latency=true global.threads=$t cargo +stable run --profile release-lto --all-features -- bench -s $STORE_DIR/$s.toml -b $benchmark 2>/dev/null)"
echo "threads $t $data" | tee -a $s-$b.txt
done
done
done

gnuplot $DIR/plot.gpl

0 comments on commit e827079

Please sign in to comment.