-
Notifications
You must be signed in to change notification settings - Fork 844
Make sure that the thread local time is updated timely #10163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
How about this instead? #10164 |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that this does away with the get_hrtime_updated vs get_hrtime distinction. It sounds like your benchmarks shows it's performant too.
I approve. I would appreciate hearing @masaori335's thoughts as well.
I think 10164 essentially reverts everything back to as before the time "cache" became thread_local. Since these are high res values, odds are that you will always write the updated time. It will fix yahoo's problem, but essentially is the same as reverting 72e6602 in almost all cases. |
472f650 to
64bb4a9
Compare
|
To record here also as 'coarse' clocks are mentioned. Underlying kernel config affects the resolution of that clock source. https://www.kernel.org/doc/html/latest/core-api/timekeeping.html |
bneradt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tested with this patch internally and confirmed it resolves the latency metrics issue we saw with thread_local.
Thanks for working on this!
| .. ts:cv:: CONFIG proxy.config.system_clock INT 0 | ||
| *For advanced users only*. This allows to specify the underlying system clock | ||
| used by ATS. The default is ``CLOCK_REALTIME`` (``0``), but a higher performance | ||
| option could be ``CLOCK_REALTIME_COARSE`` (``5``). See ``clock_gettime(2)``_ for | ||
| more details. | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we say something about how to ascertain the values of these? My man page for clock_gettime lists the names but not values (0, 5, etc). Or, since it is low level, do we assume they can figure out how to get the values from the appropriate .h file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can add something about where to find the numbers. But if they can’t find that they probably shouldn’t be messing with this :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's defined in the time.h on Linux.
Linux (https://github.com/torvalds/linux/blob/v6.4/include/uapi/linux/time.h)
#define CLOCK_REALTIME 0
#define CLOCK_REALTIME_COARSE 5
Now, another CAVEAT is the value depends on the platform.
FreeBSD (https://github.com/freebsd/freebsd-src/blob/release/13.2.0/sys/sys/_clock_id.h)
#define CLOCK_REALTIME 0
#define CLOCK_REALTIME_FAST 10
#define CLOCK_REALTIME_COARSE CLOCK_REALTIME_FAST
macOS doesn't support CLOCK_REALTIME_COARSE
_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0,
#define CLOCK_REALTIME _CLOCK_REALTIME
|
I'm +1 of getting rid of the
|
5e8fd06 to
4488f6a
Compare
* Make sure that the thread local time is updated timely * Remove dead TSC code from the dark ages * Adds a new configuration option, and defaults to CLOCK_REALTIME (cherry picked from commit ba467a8)
This adds back the get_htrime call to the constructor of QUICSentPacketInfo that was accidentally removed in apache#10163.
* Make sure that the thread local time is updated timely * Remove dead TSC code from the dark ages * Adds a new configuration option, and defaults to CLOCK_REALTIME (cherry picked from commit ba467a8)
This adds back the get_htrime call to the constructor of QUICSentPacketInfo that was accidentally removed in #10163.
* Make sure that the thread local time is updated timely * Remove dead TSC code from the dark ages * Adds a new configuration option, and defaults to CLOCK_REALTIME (cherry picked from commit ba467a8) Co-authored-by: Leif Hedstrom <zwoop@apache.org>
…apache#10183) * Make sure that the thread local time is updated timely * Remove dead TSC code from the dark ages * Adds a new configuration option, and defaults to CLOCK_REALTIME (cherry picked from commit ba467a8) Co-authored-by: Leif Hedstrom <zwoop@apache.org>
* asf/master: (221 commits) LSan: Fix leak of test_Metrics (apache#10179) LSan: Fix memory leak of test_EventSystem (apache#10178) LSan: Fix memory leak of test_X509HostnameValidator (apache#10161) Remove cqtx log field (apache#10111) Require ATS plugins to be compiled with C++17. (apache#10007) Fix conf_remap plugin build on macOS (apache#10177) libswoc: Update to 1.5.4 (apache#10155) Makes cmake build again, on macOS (apache#10172) Check SNI in h3 (apache#10184) Remove autoconf headers during CMake configuration (apache#10173) test_QUICLossDetector.cc: Add back get_hrtime() (apache#10185) ink_ink_get_hrtime -> ink_get_hrtime (apache#10182) mgmt: make libconfigmanager a true static library (apache#10181) Make sure that the thread local time is updated timely (apache#10163) Unrequire remap rules for OCSP (apache#10146) cache_range test performance improvement (apache#10170) Clean up certifier plugin debug messages. (apache#9975) cmake: add check for clock_gettime (apache#10169) Remove Http3NoError allocations (apache#10165) Fix Throttler initialization. (apache#10154) ...
This tries to fix the problem Yahoo is seeing with times on short lived requests are skewed now when the thread local times aren't updated as often as they need to be. This does
co-author: Chris McFarlen, Craig Taylor