Uploaded image for project: 'Traffic Server'
  1. Traffic Server
  2. TS-4149

Add milestone for activity before TS_EVENT_HTTP_SSN_START

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 7.2.0
    • Logging, TS API

    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

        1. usingmutex.png
          7 kB
          Scott Beardsley
        2. nullmutex.png
          6 kB
          Scott Beardsley

        Issue Links

          Activity

            People

              bcall Bryan Call
              sc0ttbeardsley Scott Beardsley
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: