Sudheer Vinukonda created TS-3768:
-------------------------------------

             Summary: implement a tiered back-off in read-while-writer retries
                 Key: TS-3768
                 URL: https://issues.apache.org/jira/browse/TS-3768
             Project: Traffic Server
          Issue Type: Bug
          Components: Cache
            Reporter: Sudheer Vinukonda


There's some code in the current cache layer that attempts to do a tiered back 
off in reattempting read-while-writer (either for acquiring writer lock or 
waiting for the first fragment download etc), but, that code is buggy (see 
below).

https://github.com/apache/trafficserver/blob/master/iocore/cache/P_CacheInternal.h#L100

{code}
#define VC_SCHED_WRITER_RETRY()                                   \
  do {                                                            \
    ink_assert(!trigger);                                         \
    writer_lock_retry++;                                          \
    ink_hrtime _t = WRITER_RETRY_DELAY;                           \
    if (writer_lock_retry > 2)                                    \
      _t = WRITER_RETRY_DELAY * 2;                                \
    else if (writer_lock_retry > 5)                               \
      _t = WRITER_RETRY_DELAY * 10;                               \
    else if (writer_lock_retry > 10)                              \
      _t = WRITER_RETRY_DELAY * 100;                              \
    trigger = mutex->thread_holding->schedule_in_local(this, _t); \
    return EVENT_CONT;                                            \
  } while (0)
{code}

Presently, the retry happens as follows: 

{{WRITER_RETRY_DELAY, WRITER_RETRY_DELAY, 2*WRITER_RETRY_DELAY, 
2*WRITER_RETRY_DELAY, 2*WRITER_RETRY_DELAY etc}}

I'm removing the buggy code with TS-3767 to avoid confusion, but, opening this 
jira per [~zwoop]'s suggestion to implement a proper tiered back off in the 
future.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to