bneradt commented on PR #9172:
URL: https://github.com/apache/trafficserver/pull/9172#issuecomment-1306567048

   > FWIW, hostdb has been using `std::chrono::system_clock::now()` since the 
hostdb restructure.
   > 
   > 
https://github.com/apache/trafficserver/blob/800d807c82af5b5e288165d118a04b26385e854a/iocore/hostdb/HostDB.cc#L1475
   
   Yes, but please be aware that the `hostdb_current_timestamp` is being set in 
its own periodic handler which triggers every second and the rest of hostdb 
uses that cached value. That is, `ts_clock::now()` is intentionally only called 
every second and all high-frequency code uses the cached value stored in 
`hostdb_current_timestamp`. Here is where that handler is scheduled:
   
   
https://github.com/apache/trafficserver/blob/800d807c82af5b5e288165d118a04b26385e854a/iocore/hostdb/HostDB.cc#L507-L511
   
   I'm not sure whether that is necessary or not. Maybe `ts_clock::now()` is 
performant in high use situations. I'm not sure offhand. I thought such calls 
ultimately made a system call and were expensive, but it seemed like in our 
PR/issue call today that others had a different understanding of this. 
Nonetheless, I want to make the observation that in hostdb the call to 
`ts_clock::now()` is, seemingly, intentionally called only every second and all 
other users of that value use the cached value.


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