Description
I ran into a pretty big performance issue in a plugin when it created a mutex in the TS_EVENT_HTTP_SSN_START hook. This caused a significant delay in processing the request. It ended up delaying sending the request to the origin by between 50 and 100ms at the 75%+ percentile! Here is a sample plugin which illustrates the problem:
#include <ts/ts.h> #include <cstddef> int globalHandler(TSCont continuation, TSEvent event, void * data) { TSHttpSsn session = static_cast< TSHttpSsn >(data); TSHttpSsnReenable(session, TS_EVENT_HTTP_CONTINUE); return 0; } void TSPluginInit(int argc, const char * * argv) { TSPluginRegistrationInfo info; info.plugin_name = const_cast< char * >(PLUGIN_TAG); // If we create a Mutex here there is huge, unaccounted for TTFB latency TSCont continuation = TSContCreate(globalHandler, TSMutexCreate()); // the following will "fix" this problem assuming you don't actually need the mutex // TSCont continuation = TSContCreate(globalHandler, NULL); TSHttpHookAdd(TS_HTTP_SSN_START_HOOK, continuation); }
What is also bad about this performance problem is that it is not visible in any of the milestone metrics including ttms. It shows up as a delay between in TTFB on the client side. It caused a lot of confusion to not be able to see the latency in slow logs, thus this request to expose the time spent here to the milestones.
Attachments
Attachments
Issue Links
- relates to
-
TS-4281 Slow log and milestone updates
- Open