redict/tests/unit
Oran Agra d4e7ffb38c
Improve active defrag in jemalloc 5.2 (#9778)
Background:
Following the upgrade to jemalloc 5.2, there was a test that used to be flaky and
started failing consistently (on 32bit), so we disabled it ​(see #9645).

This is a test that i introduced in #7289 when i attempted to solve a rare stagnation
problem, and it later turned out i failed to solve it, ans what's more i added a test that
caused it to be not so rare, and as i mentioned, now in jemalloc 5.2 it became consistent on 32bit.

Stagnation can happen when all the slabs of the bin are equally utilized, so the decision
to move an allocation from a relatively empty slab to a relatively full one, will never
happen, and in that test all the slabs are at 50% utilization, so the defragger could just
keep scanning the keyspace and not move anything.

What this PR changes:
* First, finally in jemalloc 5.2 we have the count of non-full slabs, so when we compare
  the utilization of the current slab, we can compare it to the average utilization of the non-full
  slabs in our bin, instead of the total average of our bin. this takes the full slabs out of the game,
  since they're not candidates for migration (neither source nor target).
* Secondly, We add some 12% (100/8) to the decision to defrag an allocation, this is the part
  that aims to avoid stagnation, and it's especially important since the above mentioned change
  can get us closer to stagnation.
* Thirdly, since jemalloc 5.2 adds sharded bins, we take into account all shards (something
  that's missing from the original PR that merged it), this isn't expected to make any difference
  since anyway there should be just one shard.

How this was benchmarked.
What i did was run the memefficiency test unit with `--verbose` and compare the defragger hits
and misses the tests reported.
At first, when i took into consideration only the non-full slabs, it got a lot worse (i got into
stagnation, or just got a lot of misses and a lot of hits), but when i added the 10% i got back
to results that were slightly better than the ones of the jemalloc 5.1 branch. i.e. full defragmentation
was achieved with fewer hits (relocations), and fewer misses (keyspace scans).
2021-11-21 13:35:39 +02:00
..
moduleapi fix short timeout in replication short read tests (#9763) 2021-11-09 22:37:18 +02:00
type Fix crashes when list-compress-depth is used. (#9779) 2021-11-18 18:09:30 +02:00
acl.tcl Treat subcommands as commands (#9504) 2021-10-20 11:52:57 +03:00
aofrw.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
auth.tcl Prevent unauthenticated client from easily consuming lots of memory (CVE-2021-32675) (#9588) 2021-10-04 12:10:31 +03:00
bitfield.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
bitops.tcl Change lzf to handle values larger than UINT32_MAX (#9776) 2021-11-16 13:12:25 +02:00
client-eviction.tcl Client eviction ci issues (#9549) 2021-09-26 17:45:02 +03:00
cluster.tcl fix new cluster tests issues (#9657) 2021-10-20 15:40:28 +03:00
dump.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
expire.tcl Tune expire test threshold. (#9775) 2021-11-13 07:55:48 +02:00
geo.tcl GEO* STORE with empty src key delete the dest key and return 0, not empty array (#9271) 2021-08-01 19:32:24 +03:00
hyperloglog.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
info.tcl Treat subcommands as commands (#9504) 2021-10-20 11:52:57 +03:00
introspection-2.tcl Fix COMMAND GETKEYS on EVAL without keys (#9733) 2021-11-03 14:38:26 +02:00
introspection.tcl Connection leak in external tests. (#9777) 2021-11-15 11:07:43 +02:00
keyspace.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
latency-monitor.tcl Treat subcommands as commands (#9504) 2021-10-20 11:52:57 +03:00
lazyfree.tcl attempt to fix tracking test issue with external tests due to lazy free (#9722) 2021-11-02 16:42:53 +02:00
limits.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
maxmemory.tcl Replication backlog and replicas use one global shared replication buffer (#9166) 2021-10-25 09:24:31 +03:00
memefficiency.tcl Improve active defrag in jemalloc 5.2 (#9778) 2021-11-21 13:35:39 +02:00
multi.tcl Reject PING with MASTERDOWN when replica-serve-stale-data=no (#9757) 2021-11-18 10:53:17 +02:00
networking.tcl Pre-test bind-source-addr before running test. (#9214) 2021-07-11 09:54:07 +03:00
obuf-limits.tcl Better error handling for updateClientOutputBufferLimit. (#9308) 2021-08-29 15:03:05 +03:00
oom-score-adj.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
other.tcl Connection leak in external tests. (#9777) 2021-11-15 11:07:43 +02:00
pause.tcl Fix wrong offset when replica pause (#9448) 2021-09-08 16:07:25 +08:00
pendingquerybuf.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
printver.tcl Print version info before running the test 2011-05-20 11:44:54 +02:00
protocol.tcl Tests: add a few missing needs:debug tags. (#9806) 2021-11-18 23:01:56 +02:00
pubsub.tcl Connection leak in external tests. (#9777) 2021-11-15 11:07:43 +02:00
querybuf.tcl Ignore resize threshold on idle qbuf resizing (#9322) 2021-08-06 20:50:34 +03:00
quit.tcl Add tests for OK on QUIT 2010-10-15 12:54:53 +02:00
scan.tcl Replace all usage of ziplist with listpack for t_zset (#9366) 2021-09-09 18:18:53 +03:00
scripting.tcl Connection leak in external tests. (#9777) 2021-11-15 11:07:43 +02:00
shutdown.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00
slowlog.tcl slowlog get command supports passing in -1 to get all logs. (#9018) 2021-06-14 16:46:45 +03:00
sort.tcl Add SORT_RO command (#9299) 2021-08-09 09:40:29 +03:00
tls.tcl Add support for reading encrypted keyfiles. (#8644) 2021-03-22 13:27:46 +02:00
tracking.tcl Solve issues with tracking test in external mode (#9726) 2021-11-02 16:07:51 -07:00
violations.tcl Fix ziplist and listpack overflows and truncations (CVE-2021-32627, CVE-2021-32628) (#9589) 2021-10-04 12:11:02 +03:00
wait.tcl Improve test suite to handle external servers better. (#9033) 2021-06-09 15:13:24 +03:00