Make semi-ordered-set rehashing configurable to aid in latency tuning
This commit is contained in:
parent
d4555a6e38
commit
687850a612
@ -40,6 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *KEYDB_SET_VERSION = KEYDB_REAL_VERSION;
|
const char *KEYDB_SET_VERSION = KEYDB_REAL_VERSION;
|
||||||
|
size_t g_semiOrderedSetTargetBucketSize = 0; // Its a header only class so nowhere else for this to go
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
* Config file name-value maps.
|
* Config file name-value maps.
|
||||||
@ -2910,6 +2911,7 @@ standardConfig configs[] = {
|
|||||||
createBoolConfig("allow-write-during-load", NULL, MODIFIABLE_CONFIG, g_pserver->fWriteDuringActiveLoad, 0, NULL, NULL),
|
createBoolConfig("allow-write-during-load", NULL, MODIFIABLE_CONFIG, g_pserver->fWriteDuringActiveLoad, 0, NULL, NULL),
|
||||||
createBoolConfig("force-backlog-disk-reserve", NULL, MODIFIABLE_CONFIG, cserver.force_backlog_disk, 0, NULL, NULL),
|
createBoolConfig("force-backlog-disk-reserve", NULL, MODIFIABLE_CONFIG, cserver.force_backlog_disk, 0, NULL, NULL),
|
||||||
createBoolConfig("soft-shutdown", NULL, MODIFIABLE_CONFIG, g_pserver->config_soft_shutdown, 0, NULL, NULL),
|
createBoolConfig("soft-shutdown", NULL, MODIFIABLE_CONFIG, g_pserver->config_soft_shutdown, 0, NULL, NULL),
|
||||||
|
createSizeTConfig("semi-ordered-set-bucket-size", NULL, MODIFIABLE_CONFIG, 0, 1024, g_semiOrderedSetTargetBucketSize, 0, INTEGER_CONFIG, NULL, NULL),
|
||||||
|
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, g_pserver->tls_port, 0, INTEGER_CONFIG, NULL, updateTLSPort), /* TCP port. */
|
createIntConfig("tls-port", NULL, MODIFIABLE_CONFIG, 0, 65535, g_pserver->tls_port, 0, INTEGER_CONFIG, NULL, updateTLSPort), /* TCP port. */
|
||||||
|
@ -27,6 +27,7 @@ namespace keydbutils
|
|||||||
template<>
|
template<>
|
||||||
size_t hash(const sdsview &);
|
size_t hash(const sdsview &);
|
||||||
}
|
}
|
||||||
|
extern size_t g_semiOrderedSetTargetBucketSize;
|
||||||
|
|
||||||
template<typename T, typename T_KEY = T, bool MEMMOVE_SAFE = false>
|
template<typename T, typename T_KEY = T, bool MEMMOVE_SAFE = false>
|
||||||
class semiorderedset
|
class semiorderedset
|
||||||
@ -41,11 +42,14 @@ class semiorderedset
|
|||||||
size_t idxRehash = (1ULL << bits_min);
|
size_t idxRehash = (1ULL << bits_min);
|
||||||
int cfPauseRehash = 0;
|
int cfPauseRehash = 0;
|
||||||
|
|
||||||
constexpr size_t targetElementsPerBucket()
|
inline size_t targetElementsPerBucket()
|
||||||
{
|
{
|
||||||
// Aim for roughly 4 cache lines per bucket (determined by imperical testing)
|
// Aim for roughly 4 cache lines per bucket (determined by imperical testing)
|
||||||
// lower values are faster but use more memory
|
// lower values are faster but use more memory
|
||||||
|
if (g_semiOrderedSetTargetBucketSize == 0)
|
||||||
return std::max((64/sizeof(T))*8, (size_t)2);
|
return std::max((64/sizeof(T))*8, (size_t)2);
|
||||||
|
else
|
||||||
|
return g_semiOrderedSetTargetBucketSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user