Skip to content

Commit

Permalink
Increase the HZ to make test more reliable (#1680)
Browse files Browse the repository at this point in the history
After introducing, #1387, we saw
a significant increase in other spurious wakeups because of the client
cron that was added, which affected the "instantaneous eventloops per
second" metric (showing it higher than before". All I did was increase
the server hz to get more samples and increase the target value. This
seems to work more consistently now. I also removed retries since the
instantaneous value isn't dependent on number of retries.

Additionally, `assert_lessthan $value [expr $retries*22000]` makes no
sense to me. The value is usually around 30-100us, since all it's doing
is waking up and running a little bit of cron. The retries doesn't make
much sense, since the retries don't impact the instantaneous value. I
just removed the retries and left the 22k value for now, maybe valgrind
is slow.

---------

Signed-off-by: Madelyn Olson <[email protected]>
  • Loading branch information
madolson authored Feb 7, 2025
1 parent da3f1c6 commit fc55142
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions tests/unit/info.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -334,21 +334,20 @@ start_server {tags {"info" "external:skip" "debug_defrag:skip"}} {

test {stats: instantaneous metrics} {
r config resetstat
set retries 0
for {set retries 1} {$retries < 4} {incr retries} {
after 1600 ;# hz is 10, wait for 16 cron tick so that sample array is fulfilled
set value [s instantaneous_eventloop_cycles_per_sec]
if {$value > 0} break
}
r config set hz 100
after 2000 ;# Wait for at least 160 cron tick so that sample array is filled
set value [s instantaneous_eventloop_cycles_per_sec]

assert_lessthan $retries 4
if {$::verbose} { puts "instantaneous metrics instantaneous_eventloop_cycles_per_sec: $value" }
assert_morethan $value 0
assert_lessthan $value [expr $retries*15] ;# default hz is 10
# Hz is configured to 100, so we expect a value of about 100, but in practice it will be lower
# because of imprecision in kernel wakeups, but we also have some other wakeups like clients cron.
assert_lessthan $value 150
set value [s instantaneous_eventloop_duration_usec]
r config set hz 10
if {$::verbose} { puts "instantaneous metrics instantaneous_eventloop_duration_usec: $value" }
assert_morethan $value 0
assert_lessthan $value [expr $retries*22000] ;# default hz is 10, so duration < 1000 / 10, allow some tolerance
assert_lessthan $value 22000 ;# Sanity check to make sure the duration is within a couple of ms
} {} {io-threads:skip} ; # skip with io-threads as the eventloop metrics are different in that case.


Expand Down

0 comments on commit fc55142

Please sign in to comment.