TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

The Speed of Time

142 点作者 tuananh超过 3 年前

9 条评论

xyzzyz超过 3 年前
&gt; A Cassandra database cluster had switched to Ubuntu and noticed write latency increased by over 30%. A quick check of basic performance statistics showed over 30% higher CPU consumption. What on Earth is Ubuntu doing that results in 30% higher CPU time!?<p>Also, think about it this way: imagine if you started out with Ubuntu. You’d then likely never notice that your system is 30% slower than it needs be.<p>Now, take it further: the system from which you moved to Ubuntu most likely has not been the most efficient it could get either, and it was also likely that random crap was sapping significant amount of performance.<p>And finally, extend this from Cassandra and Ubuntu to everything else. Welcome to 2021, where machines are faster than ever, but things feel as slow as they have always been.
评论 #28666915 未加载
justinsaccount超过 3 年前
This can be a problem on physical machines too.<p>Ran into an issue where on two identical machines one was showing cpu usage 30% higher. A quick `perf top` showed it was spending the majority of its time in `read_hpet` in the kernel. Found that one machine was set to hpet because the kernel thought tsc was unstable at bootup:<p><pre><code> tsc: Marking TSC unstable due to check_tsc_sync_source failed </code></pre> Only ever happened one time and we could never reproduce it. bios&#x2F;firmware updates might have also helped. We still added a monitoring check to ensure that current_clocksource was tsc.
cperciva超过 3 年前
FreeBSD&#x2F;EC2 uses TSC starting with 13.0, and this caused some issues with t3.* instances -- I&#x27;m told however that this is due to a bug in EC2 which will be fixed. TSC has been totally solid on other instance types, however.<p>Just some data points for anyone with an interest in EC2 and clock sources...
评论 #28669648 未加载
FpUser超过 3 年前
I had closely related problem in desktop application. It does some device control and works on USB interrupts at 256 or 512 invocations per sec. To account for a jitter and some other things I also inserted some time measuring calls. Inside the handler there were some calculations but I&#x27;ve discovered that those consume disproportionate amount of time. The investigation revealed that on multicore CPUs QueryPerformanceCounter call can take 1 microsecond. Since I had quite a few of those it added up to way too much. Ended up writing small piece of assembly that checked if invariant TSC is supported on CPU (which it is for any reasonable CPU) and replaced time measuring calls supplied by the OS to RDTSC that takes just nanoseconds.<p>The strange thing is that where possible QueryPerformanceCounter should use just RDTSC internally accordingly to docs. By timing it it appears that at least in my case it did not.
lifthrasiir超过 3 年前
I&#x27;m surprised that Java uses gettimeofday (equivalent to CLOCK_REALTIME in clock_gettime calls) instead of CLOCK_REALTIME_COARSE for os::javaTimeMillis(). IIRC the resolution of the coarse clock has been 1 ms since around Linux 3.0 and it can avoid most system calls even if the underlying clock source needs them. Of course it can&#x27;t be used if you need sub-ms resolution, but the function name clearly suggests that it only needs millisecond resolution (as per System.currentTimeMillis) so using a plain gettimeofday seems inefficient. For the reference, glibc implementation of time() (which has 1 second resolution) internally uses coarse clocks.
评论 #28668025 未加载
dboreham超过 3 年前
Back when I was involved with shipping server products on a raft of different Unixen, this was a major issue -- code written originally on, say Solaris, would run like a dog on HP-UX because it fetched the time constantly.
PaulHoule超过 3 年前
It doesn&#x27;t surprise me.<p>When I was thinking about &quot;What could system calls look like in a clean-sheet OS?&quot; (e.g. async-only) I always found time() was a special case that opened the door to more special cases since time() is usually almost all overhead and it often gets called often.
评论 #28672786 未加载
评论 #28678106 未加载
2rsf超过 3 年前
As a side note I am really impressed from how the whole investigation process is well documented.<p>I am also involved in similar detective works, but usually I tend to forget the initial parts before anyone figures out that it is an investigation
jdlyga超过 3 年前
The speed of time is 1 second per second
评论 #28675123 未加载