cmcfarlen opened a new pull request, #14118:
URL: https://github.com/apache/trafficserver/pull/14118

   When many requests read one cached object, they all contend for that 
object's stripe lock. A small object served
   from memory took the stripe lock three times per request:
   
   1. `Cache::open_read`, for the directory probe and the RAM cache lookup;
   2. `openReadStartHead`, immediately after `open_read` released it, on the 
same thread;
   3. `openReadClose`, to release preservation state that a single-fragment 
read never acquires (`begin_read`
      returns early for single-fragment documents).
   
   With `proxy.config.cache.stripe_lock_trim: 1`:
   
   - `open_read` hands its hold to `openReadStartHead` instead of releasing and 
re-taking it. The hand-off uses a new
     `MutexTryLock::hand_off()`: the mutex stays held and the next handler's 
first lock of it adopts the hold
     instead of nesting, so the handler still decides when it is released. 
`Mutex_release_unadopted()` drops a hold
     no handler took, and `calluser`/`callcont` call it before calling out, so 
the rule that no user callback runs
     under the stripe lock still holds.
   - `openReadClose` skips the lock for a single-fragment read that was not 
marked for evacuation.
   
   The setting defaults to `0` and is reloadable.
   
   Testing:
   
   - New `test_Lock` cases for hand-off, adoption, an unadopted hold, and a 
nested hold.
   - Uranium tests matching `cache`, `slice`, `range`, `bigobj` or `writer` 
(141 tests) pass in the Fedora 44 CI
     container with the setting defaulted to `1`.
   - Benchmark, 32 threads, HTTP/2 RAM-cache hits, against this branch's parent:
     - one hot object at `mutex_retry_delay: 10`: +18% throughput, p50 halved 
(15 to 7 ms);
     - one hot object at `mutex_retry_delay: 2`: +64% throughput;
     - 16 objects, and ~150K objects: within noise.
   


-- 
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