Disable async rehash with single threads, it causes slowdowns as the rehash never completes

Former-commit-id: 5d08dbdf76c0fd1e0cfcf86b97ef3e656f0e4f5d
This commit is contained in:
John Sully 2021-02-16 21:07:43 +00:00
parent c43bb8e8b5
commit 3ac42ec80c

View File

@ -1950,7 +1950,7 @@ void databasesCron(bool fMainThread) {
::dict *dict = g_pserver->db[rehash_db]->dictUnsafeKeyOnly();
/* Are we async rehashing? And if so is it time to re-calibrate? */
/* The recalibration limit is a prime number to ensure balancing across threads */
if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled) {
if (rehashes_per_ms > 0 && async_rehashes < 131 && !cserver.active_defrag_enabled && cserver.cthreads > 1) {
serverTL->rehashCtl = dictRehashAsyncStart(dict, rehashes_per_ms);
++async_rehashes;
}