zwoop commented on pull request #8052:
URL: https://github.com/apache/trafficserver/pull/8052#issuecomment-881646594


   After discussions with Masaori (thanks for all the insights!), I think a 
patch like this achieves a similar performance gain, and is less invasive. I've 
benchmarked this under heavy load, using pretty complex plugin rules to read 
and modify headers, and this patch sees about a 25% performance (RPS) increase.
   
   ```
   diff --git a/iocore/eventsystem/I_Thread.h b/iocore/eventsystem/I_Thread.h
   index 7ec7c3ebc..c08bfd900 100644
   --- a/iocore/eventsystem/I_Thread.h
   +++ b/iocore/eventsystem/I_Thread.h
   @@ -134,6 +134,7 @@ public:
      ProxyAllocator ioDataAllocator;
      ProxyAllocator ioAllocator;
      ProxyAllocator ioBlockAllocator;
   +  ProxyAllocator mHandleAllocator;
    
      /** Start the underlying thread.
    
   diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
   index ebe7ab9bc..d9b7d375d 100644
   --- a/src/traffic_server/InkAPI.cc
   +++ b/src/traffic_server/InkAPI.cc
   @@ -773,7 +773,7 @@ isWriteable(TSMBuffer bufp)
    static MIMEFieldSDKHandle *
    sdk_alloc_field_handle(TSMBuffer /* bufp ATS_UNUSED */, MIMEHdrImpl *mh)
    {
   -  MIMEFieldSDKHandle *handle = mHandleAllocator.alloc();
   +  MIMEFieldSDKHandle *handle = THREAD_ALLOC(mHandleAllocator, 
this_thread());
    
      // TODO: Should remove this when memory allocation can't fail.
      sdk_assert(sdk_sanity_check_null_ptr((void *)handle) == TS_SUCCESS);
   @@ -788,7 +788,7 @@ static void
    sdk_free_field_handle(TSMBuffer bufp, MIMEFieldSDKHandle *field_handle)
    {
      if (sdk_sanity_check_mbuffer(bufp) == TS_SUCCESS) {
   -    mHandleAllocator.free(field_handle);
   +    THREAD_FREE(field_handle, mHandleAllocator, this_thread());
      }
    }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to