You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "ywkaras (via GitHub)" <gi...@apache.org> on 2023/08/09 00:42:04 UTC

[GitHub] [trafficserver] ywkaras opened a new pull request, #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

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

   This variable is used frequently in most threads.  By avoiding unnecessary writes of it, locks of its cache line in (all) per-core caches are reduced.  This should reduce CPU core stalls.  The variable thus does not need to be thread_local.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1671837866

   @ywkaras I got rid of all the TSC stuff, so that's all gone. This version is as fast as current master, solves all of Yahoo's problems, simplifies the usage, and guarantees 1ms or better accuracy.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1670524217

   [approve ci freebsd]


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras closed pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras closed pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.
URL: https://github.com/apache/trafficserver/pull/10164


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1670627341

   This doesn't make a whole lot of sense. You may as well get rid of the cache completely, and just call ink_get_hrtime_internal() directly. I made a version of my patch that does exactly that, and it's reasonably fast, but not as fast as current master.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1671614838

   So, in a nutshell, the issue is, how, and in what weird ways, are we going to fuzz the high-res clock, in order to improve performance.  Yahoo prod says that the current fuzzing (that resulted from thread_local cur_time) changes ATS stats, making it look like transactions take longer.
   
   Hard to know the relative performance of my change without testing.  Depends how often get_hrtime_updated() is called.  (Typically several hundred instructions execute per nanosecond I think.)  The performance would also be better if ink_get_hrtime_internal() returns a time that is already fuzzed.  That is, the granularity is not really one nanosecond.
   
   We could improve performance of my change by adding fuzzing, by only updating cur_time if it's less than now by some delta.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1670628691

   I'd imagine in almost all cases, now > cur_time will be true, which means this code is the same as before making the data thread local. In that case, I made a version of my patch that just calls clock_gettime() directly every time. It's fast, but not quite as fast as the current thread local version with the update.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] ywkaras commented on pull request #10164: Avoid unnecessary (multi-core) writes of Thread::cur_time.

Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on PR #10164:
URL: https://github.com/apache/trafficserver/pull/10164#issuecomment-1671886106

   Seems like switching to a coarse clock may make the clock more fuzzy.  So, maybe Yahoo prod would still see squirrelly metrics.


-- 
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: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org