diff options
author | filipe oliveira <filipecosta.90@gmail.com> | 2021-01-29 13:38:30 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-29 15:38:30 +0200 |
commit | f0c5052aa8de084f54b3eda7848f17b122907509 (patch) | |
tree | 4fe4c390f7373e765d7e1ba8c3bc5d388c365696 /runtest-moduleapi | |
parent | b9a0500f16d0cd016398133cc7ac256ad927b679 (diff) | |
download | redis-f0c5052aa8de084f54b3eda7848f17b122907509.tar.gz |
Enabled background and reply time tracking on blocked on keys/blocked on background work clients (#7491)
This commit enables tracking time of the background tasks and on replies,
opening the door for properly tracking commands that rely on blocking / background
work via the slowlog, latency history, and commandstats.
Some notes:
- The time spent blocked waiting for key changes, or blocked on synchronous
replication is not accounted for.
- **This commit does not affect latency tracking of commands that are non-blocking
or do not have background work.** ( meaning that it all stays the same with exception to
`BZPOPMIN`,`BZPOPMAX`,`BRPOP`,`BLPOP`, etc... and module's commands that rely
on background threads ).
- Specifically for latency history command we've added a new event class named
`command-unblocking` that will enable latency monitoring on commands that spawn
background threads to do the work.
- For blocking commands we're now considering the total time of a command as the
time spent on call() + the time spent on replying when unblocked.
- For Modules commands that rely on background threads we're now considering the
total time of a command as the time spent on call (main thread) + the time spent on
the background thread ( if marked within `RedisModule_MeasureTimeStart()` and
`RedisModule_MeasureTimeEnd()` ) + the time spent on replying (main thread)
To test for this feature we've added a `unit/moduleapi/blockonbackground` test that relies on
a module that blocks the client and sleeps on the background for a given time.
- check blocked command that uses RedisModule_MeasureTimeStart() is tracking background time
- check blocked command that uses RedisModule_MeasureTimeStart() is tracking background time even in timeout
- check blocked command with multiple calls RedisModule_MeasureTimeStart() is tracking the total background time
- check blocked command without calling RedisModule_MeasureTimeStart() is not reporting background time
Diffstat (limited to 'runtest-moduleapi')
-rwxr-xr-x | runtest-moduleapi | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/runtest-moduleapi b/runtest-moduleapi index 878b5c6ad..e554226c1 100755 --- a/runtest-moduleapi +++ b/runtest-moduleapi @@ -23,6 +23,7 @@ $TCLSH tests/test_helper.tcl \ --single unit/moduleapi/hooks \ --single unit/moduleapi/misc \ --single unit/moduleapi/blockonkeys \ +--single unit/moduleapi/blockonbackground \ --single unit/moduleapi/scan \ --single unit/moduleapi/datatype \ --single unit/moduleapi/auth \ |