Skip to content

Commit

Permalink
docs(journal): add slide about t-test and more data for 512 case
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Mar 22, 2022
1 parent 38f30c3 commit df5de3f
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 11 deletions.
Binary file modified doc/demo-journal/images/journal-benchmark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
43 changes: 38 additions & 5 deletions doc/demo-journal/slides-journal.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,48 @@ done
echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo

# The following run is just a (CPU) warm up, the results are discarded.
cabal run bench-sqlite
bench-sqlite

for i in $(seq 10); do
for j in $(seq 2 12); do
cabal run bench-journal -- $((2**$j)) >> /tmp/bench-journal-$j.txt
cabal run bench-sqlite -- $((2**$j)) >> /tmp/bench-sqlite-$j.txt
bench-journal -- $((2**$j)) >> /tmp/bench-journal-$j.txt
bench-sqlite -- $((2**$j)) >> /tmp/bench-sqlite-$j.txt
done
done
```

# Benchmark statistics

```R
Input512=("
workload throughput
journal-512 6129.90
...
journal-512 5756.72
sqlite-512 4851.46
...
sqlite-512 6735.40
")

df512 = read.table(textConnection(Input512),header=TRUE)
bartlett.test(df512$throughput ~ df512$workload, data=df512)

t.test(df512$throughput ~ df512$workload, data=df512,
var.equal=TRUE,
conf.level=0.95)
```

* Output

```bash
data: df512$throughput by df512$workload
t = 0.29646, df = 18, p-value = 0.7703
mean in group journal-512 mean in group sqlite-512
5937.373 5839.218
```

# Benchmark plot

![](./images/journal-benchmark.jpg)

# Amdahl's law vs the Universal scalability law
Expand Down Expand Up @@ -265,7 +295,7 @@ done
# Summary

* We have shown how to use the journal to:
- Faster write path than with a database (lock-free and append only)
- Faster write path than with a database (lock-free, append only and zero-copy)
- Get faster crash recovery for free
- Get all the deterministic testing stuff for free
- Rich time traveling debugger
Expand Down Expand Up @@ -298,6 +328,9 @@ done
for the journal version of the service;

* Using the Linux kernel's `io_uring` to ammortise the cost of syscalls (by
batching and doing them async).
batching and doing them async);

* But protocol improvements are likely much more important for performance than
these low-level database engine and event loop improvements!

# Thanks! Questions? References:
Binary file modified doc/demo-journal/slides-journal.pdf
Binary file not shown.
4 changes: 4 additions & 0 deletions src/journal/src/Journal/Internal/BufferClaim.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ commit :: BufferClaim -> Logger -> IO ()
commit (BufferClaim bb) logger = do
let Capacity frameLen = getCapacity bb
logg logger ("commit, frameLen: " ++ show frameLen)
-- XXX:
-- forceAt bb 0 frameLen
writeFrameType bb 0 Valid
writeFrameLength bb 0 (HeaderLength (int2Int32 frameLen))
{-# INLINE commit #-}

abort :: BufferClaim -> IO ()
abort (BufferClaim bb) = do
let Capacity frameLen = getCapacity bb
writeFrameType bb 0 Padding
writeFrameLength bb 0 (HeaderLength (int2Int32 frameLen))
{-# INLINE abort #-}
7 changes: 5 additions & 2 deletions src/journal/src/Journal/Internal/ByteBufferPtr.hs
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,14 @@ force :: ByteBuffer -> IO ()
force bb =
withForeignPtr (bbData bb) $ \ptr ->
msync ptr (fromIntegral (bbCapacity bb)) mS_SYNC False
{-# INLINE force #-}

forceAt :: ByteBuffer -> Int -> Int -> IO ()
forceAt bb offset len =
forceAt bb offset len = do
Slice slice <- readIORef (bbSlice bb)
withForeignPtr (bbData bb) $ \ptr ->
msync (ptr `plusPtr` offset) (fromIntegral len) mS_SYNC False
msync (ptr `plusPtr` (slice + offset)) (fromIntegral len) mS_SYNC False
{-# INLINE forceAt #-}

------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/sut/dumblog/bench/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ rEAD_FREQUENCY :: Int
rEAD_FREQUENCY = 80

iTERATIONS :: Int
iTERATIONS = 50000
iTERATIONS = 100000

vALUE_TO_WRITE :: ByteString
vALUE_TO_WRITE = LBS.pack "Dumblog"
Expand Down
46 changes: 43 additions & 3 deletions src/sut/dumblog/tools/benchmark-plot.r
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ df256 = read.table(textConnection(Input256),header=TRUE)
bartlett.test(df256$throughput ~ df256$workload, data=df256)

t.test(df256$throughput ~ df256$workload, data=df256,
var.equal=TRUE,
var.equal=FALSE,
conf.level=0.95)

Input512=("
Expand All @@ -255,6 +255,26 @@ journal-512 5780.60
journal-512 5756.72
journal-512 6042.59
journal-512 5895.52
journal-512 5901.41
journal-512 5850.24
journal-512 5947.85
journal-512 5907.77
journal-512 6093.77
journal-512 5928.50
journal-512 5827.59
journal-512 5982.38
journal-512 6003.93
journal-512 5882.08
journal-512 5875.74
journal-512 5744.34
journal-512 5643.23
journal-512 6082.79
journal-512 6206.22
journal-512 5982.41
journal-512 5722.13
journal-512 5902.64
journal-512 5924.12
journal-512 5849.07
sqlite-512 4851.46
sqlite-512 4175.24
sqlite-512 5001.94
Expand All @@ -265,6 +285,26 @@ sqlite-512 6603.62
sqlite-512 6625.08
sqlite-512 6482.68
sqlite-512 6430.65
sqlite-512 4714.32
sqlite-512 4250.24
sqlite-512 6604.46
sqlite-512 4997.60
sqlite-512 4718.35
sqlite-512 6752.57
sqlite-512 4274.27
sqlite-512 6255.25
sqlite-512 5831.62
sqlite-512 4677.35
sqlite-512 6265.19
sqlite-512 4534.84
sqlite-512 4561.84
sqlite-512 4579.69
sqlite-512 6674.64
sqlite-512 4278.95
sqlite-512 6830.67
sqlite-512 6454.88
sqlite-512 5122.86
sqlite-512 4319.10
")

df512 = read.table(textConnection(Input512),header=TRUE)
Expand Down Expand Up @@ -302,7 +342,7 @@ df1024 = read.table(textConnection(Input1024),header=TRUE)
bartlett.test(df1024$throughput ~ df1024$workload, data=df1024)

t.test(df1024$throughput ~ df1024$workload, data=df1024,
var.equal=TRUE,
var.equal=FALSE,
conf.level=0.95)

Input2048=("
Expand Down Expand Up @@ -374,7 +414,7 @@ c32 <- c(6440.925, 6015.705)
c64 <- c(6238.401, 6054.991)
c128 <- c(6129.595, 6831.315)
c256 <- c(6179.770, 6013.608)
c512 <- c(5937.373, 5839.218)
c512 <- c(5921.065, 5503.029)
c1024 <- c(5828.134, 4248.163)
c2048 <- c(5444.993, 3802.999)
c4096 <- c(4924.328, 3549.512)
Expand Down

0 comments on commit df5de3f

Please sign in to comment.