Added module-acquire-GIL latency stats (#9608)

The new value indicates how long Redis wait to
acquire the GIL after sleep. This can help identify
problems where a module perform some background
operation for a long time (with the GIL held) and
blocks the Redis main thread.
This commit is contained in:
Meir Shpilraien (Spielrein) 2021-10-06 11:33:01 +03:00 committed by GitHub
parent f5160ed0aa
commit 4fb39b6700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2973,7 +2973,15 @@ void afterSleep(struct aeEventLoop *eventLoop) {
/* Acquire the modules GIL so that their threads won't touch anything. */
if (!ProcessingEventsWhileBlocked) {
if (moduleCount()) moduleAcquireGIL();
if (moduleCount()) {
mstime_t latency;
latencyStartMonitor(latency);
moduleAcquireGIL();
latencyEndMonitor(latency);
latencyAddSampleIfNeeded("module-acquire-GIL",latency);
}
}
}