cecemei commented on PR #18750:
URL: https://github.com/apache/druid/pull/18750#issuecomment-3613883194

   > Thanks for the changes, @wuguowei1994 ! I have left some suggestions.
   > 
   > While the changes in this PR make sense by reporting the lag more 
consistently (updating the two offsets in lockstep), I was wondering if it 
wouldn't be simpler to just report zero lag in case the lag turns out to be 
negative.
   > 
   > A negative record lag does mean that the task has already caught up to the 
last offsets that we had fetched from the topic and ingested some more records 
beyond that. And the lag metric is really just meant to indicate if the tasks 
are keeping up.
   > 
   > For other purposes, we have the message gap and the time lag metrics.
   > 
   > In fact, the negative lag could even be a feature to identify if some 
tasks are particularly slow in returning their offsets. 😛 , and we could 
probably have alerts set up if the negative lag goes below a specific threshold.
   > 
   > @cecemei , I think you also raised a concern regarding the possibility 
that the lag reported might now be higher than the actual lag, since we always 
fetch the stream offsets only after we have received updates from all the tasks.
   > 
   > I think the current code is also susceptible to reporting stale lag 
(higher or lower).
   > 
   > Say if a task were slow to return its latest ingested offsets, we would be 
delayed in fetching the latest offsets from the stream. So, in that period, we 
would be reporting stale lag (which could have been higher or lower than the 
actual lag, a special case of which would be negative lag) and then as soon as 
we fetched the latest offsets from the stream, the reported lag would fix 
itself.
   
   Yes I suspect we might seeing a slightly higher lag after this change 
(comparing with what might be reported before). The accuracy of the lag would 
not be affected by when the `latestSequenceFromStream` gets updated (more 
random), but would only be affected by how long it took fetching the offsets 
(delay inside the system and interaction with kafka). I do think it provides 
more consistency than before and the trend of the lag is more important, so 
it's an improvement. 
   
   For future reference, we could maybe calculate the lag on a per partition 
basis. 


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to