1
0
mirror of https://github.com/Zygo/bees.git synced 2025-05-18 13:55:44 +02:00

hash: use the LockSet max_size to read hash table from only one thread at a time

This reduces disk thrashing at startup.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell 2017-01-11 00:47:01 -05:00
parent 920cfbc1f6
commit e7fddcbc04

View File

@ -595,6 +595,9 @@ BeesHashTable::BeesHashTable(shared_ptr<BeesContext> ctx, string filename, off_t
m_flush_rate_limit(BEES_FLUSH_RATE), m_flush_rate_limit(BEES_FLUSH_RATE),
m_stats_file(m_ctx->home_fd(), "beesstats.txt") m_stats_file(m_ctx->home_fd(), "beesstats.txt")
{ {
// Reduce disk thrashing at startup: one reader at a time
m_extent_lock_set.max_size(1);
// Sanity checks to protect the implementation from its weaknesses // Sanity checks to protect the implementation from its weaknesses
THROW_CHECK2(invalid_argument, BLOCK_SIZE_HASHTAB_BUCKET, BLOCK_SIZE_HASHTAB_EXTENT, (BLOCK_SIZE_HASHTAB_EXTENT % BLOCK_SIZE_HASHTAB_BUCKET) == 0); THROW_CHECK2(invalid_argument, BLOCK_SIZE_HASHTAB_BUCKET, BLOCK_SIZE_HASHTAB_EXTENT, (BLOCK_SIZE_HASHTAB_EXTENT % BLOCK_SIZE_HASHTAB_BUCKET) == 0);