Skip to content

Commit

Permalink
feat(sut): make clients in benchmark always start with a write
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Mar 17, 2022
1 parent 1d6796f commit a2a560a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/sut/dumblog/bench/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ commonBenchmark clients (_a, hc) = do
(max endMaxMemInUse startMaxMemInUse))

commonClient :: HttpClient -> Int -> StdGen -> IO ()
commonClient hc iterations gen = go iterations 0 gen
commonClient hc iterations gen = do
mMaxIndex <- writeHttp hc vALUE_TO_WRITE
let maxIndex = fromMaybe (error "commonClient: initial write failed...") mMaxIndex
go (iterations - 1) maxIndex gen
where
go :: Int -> Int -> StdGen -> IO ()
go 0 _maxIndex _gen = return ()
Expand Down
8 changes: 5 additions & 3 deletions src/sut/dumblog/src/Dumblog/SQLite/Main.hs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module Dumblog.SQLite.Main where

import Control.Exception (bracket)
import Control.Concurrent (MVar)
import Control.Concurrent.Async (withAsync)
import Control.Concurrent.STM.TBQueue (newTBQueueIO)
import Control.Exception (bracket)
import System.Directory (removePathForcibly)

import Journal.Internal.Metrics
import Dumblog.Common.Metrics
import Dumblog.SQLite.DB
import Dumblog.SQLite.FrontEnd
import Dumblog.SQLite.Worker
import Dumblog.SQLite.DB
import Journal.Internal.Metrics

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

Expand All @@ -24,4 +25,5 @@ sqliteDumblog capacity port mReady = do
main :: IO ()
main = do
putStrLn "Starting Dumblog (SQLite)"
removePathForcibly sQLITE_DB_PATH
sqliteDumblog (64 * 1024) 8054 Nothing

0 comments on commit a2a560a

Please sign in to comment.