mirror of https://github.com/voidlizard/hbs2
wip, faster putBlock
This commit is contained in:
parent
56d71cb988
commit
59a54fabb8
|
@ -46,6 +46,8 @@ ncqStorageOpen fp upd = do
|
|||
let shardNum = fromIntegral cap
|
||||
let wopNum = 2
|
||||
|
||||
let !ncqReadThreads = wopNum * 4
|
||||
|
||||
ncqWriteQ <- newTVarIO mempty
|
||||
ncqMemTable <- V.fromList <$> replicateM shardNum (newTVarIO mempty)
|
||||
ncqMMapCachedIdx <- newTVarIO HPSQ.empty
|
||||
|
|
|
@ -56,7 +56,7 @@ ncqStorageRun ncq@NCQStorage{..} = flip runContT pure do
|
|||
let q = ncqWriteOps ! i
|
||||
forever (liftIO $ join $ atomically (readTQueue q))
|
||||
|
||||
replicateM_ 2 $ spawnActivity $ forever $ flip runContT pure $ callCC \exit -> do
|
||||
replicateM_ ncqReadThreads $ spawnActivity $ forever $ flip runContT pure $ callCC \exit -> do
|
||||
|
||||
(h, answ) <- atomically $ readTQueue ncqReadReq
|
||||
let answer l = atomically (putTMVar answ l)
|
||||
|
|
|
@ -85,6 +85,7 @@ data NCQStorage =
|
|||
, ncqMaxLog :: Int
|
||||
, ncqMaxCachedIndex :: Int
|
||||
, ncqMaxCachedData :: Int
|
||||
, ncqReadThreads :: Int
|
||||
, ncqIdleThrsh :: Double
|
||||
, ncqMMapCachedIdx :: TVar (HashPSQ FileKey CachePrio CachedIndex)
|
||||
, ncqMMapCachedData :: TVar (HashPSQ FileKey CachePrio CachedData)
|
||||
|
|
|
@ -606,8 +606,9 @@ ncq3Tests = do
|
|||
|
||||
chu <- S.toList_ (readChunkedBS lbs (256*1024))
|
||||
hashes <- forConcurrently chu $ \chunk -> do
|
||||
-- ncqPutBS ncq (Just B) Nothing (LBS.toStrict chunk)
|
||||
ncqTossBlock ncq chunk >>= orThrowUser "can't save"
|
||||
-- ncqPutBlock ncq chunk
|
||||
-- ncqPutBS ncq (Just B) Nothing (LBS.toStrict chunk
|
||||
|
||||
none
|
||||
|
||||
|
|
Loading…
Reference in New Issue