Better HN
topnewbestaskshowjobs

Worshipping at the altar of Brendan Gregg(fzakaria.com)

208 points · by kqr · 11h ago · 38 comments

Comments
aidanhs8h ago
I really like the idea of a deterministic VM (I like Antithesis for a similar reason!), though I saw on another post that your VM is single threaded which I feel like must compromise a lot of performance analyses? E.g. when you have very high throughput multithreaded pipelines.

Personally I've really cooled on flamegraphs for the purpose of doing multithreaded performance analysis - it's so hard to infer cross-thread dependencies. I'd encourage people interested in performance analysis to read https://thume.ca/2023/12/02/tracing-methods/ (and I'd love to hear if there's something more recent than end of 2023 that has an updated census of tools) which makes a decent case for perfetto, though in my own use-cases I've just ended up creating low latency language-specific trace output library that I can aggregate and load into jaeger-ui, as you can actually add metadata indicating spans you follow from etc.

For the author: your product looks very cool, but I encourage you (or someone you pay!) to do an extensive proof reading pass to remove LLM-isms, reading stuff like "process, with what it started" as a column header of ps-like output is like nails on a chalkboard.

xyzzy_plugh6h ago
> I really like the idea of a deterministic VM (I like Antithesis for a similar reason!)

I agree, and I also like Antithesis, but I am a bit dismayed that deterministic high-performance VMs haven't become commodity yet.

I know, I know, I am impatient, and it will happen eventually, but it's frustrating to see Antithesis corner the market so hard with a closed solution.

Maybe this is a sign I should start yet another side project?

disperso5h ago
Seems very interesting. Is there some parallel to make with RR (record and replay) in terms of features, limitations, etc.?

https://github.com/rr-debugger/rr

roca1h ago
[rr maintainer here]. Similar principles but there are important differences. rr records and replays user-space processes and has to understand the user/kernel interface really well, which is a problem because that interface is super complicated. RewindVM replays the whole VM, simplifying the interface because the hypervisor interface is (or at least, can be configured to be) somewhat simpler than the user/kernel interface. The overhead of replaying at the VM level will be different ... possibly lower, possibly higher, depending on the workload; you might expect there to be fewer VM exits than system call traps, but OTOH you have to record and replay the entire guest OS instead of specific processes.

In terms of functionality, they're different. rr supports arbitrary timeslicing, e.g. thread switches at any program instruction, which ReplayVM does not. RewindVM depends on Nix, rr doesn't. RewindVM supports a kind of "mutable replay" where you can resume a VM from a checkpoint and cause it to do something different from what was previously recorded; rr's version of that is much more limited.

Veserv5h ago
Everything they described about their runtime is just a time travel debugger using a single-threaded record and replay model. So yes.

Their visualizations are techniques based around leveraging the extra data available in a full instruction trace. As such, they can be applied to any time travel debugger datastream, which trivially has a full instruction trace, or just raw instruction trace if that is all you have.

uvdn77h ago
Does this type of analysis and deterministic VM help async workloads (e.g. c++ coroutine, fiber, future, etc.)? My understanding is that they don't. I would love to know how to find the critical path for async code. It feels very hard (maybe impossible) to do without changing the framework code (e.g. embedding something like a request context so we know a later task on thread A is actually a continuation for request R).
setheron7h ago
Yes it does. Everything is deterministic even the thread orderings and all randomness that would decide asyc scheduling in user space.
uvdn76h ago
I see. I am not familiar with deterministic VMs. I can see how it can intercept all system calls. I guess randomness is deterministic as well because all the inputs to the RNG are deterministic. So everything is a deterministic state machine.
setheron6h ago
I wrote https://fzakaria.com/2026/10/24/dafuq-is-a-deterministic-vm this for a friend to better understand what it is.
adsharma6h ago
Things like this could be done via sleep profiling or CPU stall profiling.

But they involve a trade-off in the Linux kernel or spending more transistors in CPU design.

jiveturkey2h ago
sadly the answer to the investigation was just a footnote.

> 4 Turns out that the test sleeps on purpose: it is checking how far uv_hrtime moves across a sleep. There is nothing to optimize in this case.

also, no explanation of why he didn't look into the epoll_wait(). i guess because this is a blocking call, not intentionally asleep, and also the intentional sleep is magnified 600 times? epoll_wait() shows up as consuming 3x of the wall time but in the shortening analysis the nanosleeps are shown to add up to more time asleep. i'm a little confused on that.

good article, would have been great with more editing. and it would be great to also see an example where a problem is fixed.

setheron2h ago
I have been filing some of the bugs at https://rewindvm.dev/bugs.html as I work on them upstream.

I wanted the article to be more about the idea and performance investigation rather than about this one bug though.

With this much insight, lots of software has lots of bugs.

jiveturkey2h ago
Yeah, the article was successful in showing the tool, very successful. Much more of a gentleman's introduction than for example https://www.brendangregg.com/offcpuanalysis.html

I only looked at the first bug you list on the bugs.html page, and it doesn't appear to have needed or used the `time` tool. As this article is specifically about the `time` functionality, that's what I was complaining was missing from your article. Maybe that was an unfair complaint, as I can't find a single example on the internet (using Gregg's tooling, which has existed forever).

despacito8h ago
Disappointed it doesn’t involve more screaming
usrme7h ago
Reference for one of today's lucky 10,000^1: https://www.youtube.com/watch?v=tDacjrSCeq4

^1: https://xkcd.com/1053/

grg01h ago
I was one among them. Now I am reborn in the light of Brendan.
mixmastamyk5h ago
Weird title. Also, the post just ends with identifying but not solving the problem?
perdy11h ago
Determinism is the underrated part of all this. For a Python framework I maintain we moved the CI benchmarks to Callgrind: instruction counts instead of time, with the cache geometry pinned so it doesn't matter which runner you land on. The numbers basically stopped moving between runs, which wall-clock never gave us on shared runners. The catch is that you lose everything off-CPU, which is exactly what this post is about, so the critical path view is a bit enviable.
jiuge19267h ago
[flagged]
dang7h ago
Some of your recent comments have been killed by our software because they've been classified as genai text, which is not allowed on HN itself (see https://news.ycombinator.com/newsguidelines.html#generated and https://news.ycombinator.com/item?id=47340079).

(It's fine, of course, to use AI tools—we use them heavily ourselves. Just please don't use them to generate or edit text to be read by fellow humans on Hacker News.)

It's impossible to know for sure what was LLM generated or edited, but we have to rely on imperfect classifiers or else the site would be completely flooded by genai text, which is not what the community here wants to read, nor in the intended spirit of HN.

zinc_chest6311h ago
Flame graphs alone justify the worship, found a hot regex in our billing service in ten minutes
db48x9h ago
Yea, I love being able to go from the new guy at a new job straight to the performance wizard in the first week, or even on the first day. It’s so fun to stare into the depths of a flamechart and then point out where the problems are.

At one job they had built this whole nifty SQL library and used it everywhere. In the first profile I took I saw that repeatedly preparing a query took more time than running it and using the data. Each call to prepare took the same amount of time as the others, so it was obvious at a glance that they weren’t caching and reusing the results. The documentation said that they did, and their tests all worked, so they had used it for years even though it was fundamentally broken. That was a fun week.

skydhash9h ago
Any loop is the prime suspect for optimization. I’ve seen a lot of naive implementation of something instead of using standard algorithms.
sgerenser9h ago
When I worked at Microsoft, I found a particular hot function using flame graphs in a C++ application covering roughly 50% of all call paths in some runs. It was the constructor for a hand-rolled map-like data structure that was used all over the app. Switching to IIRC an abseil hash map cut the overhead by something like 98%. The app was a simulation-type thing that ran on a server for millions of cycles and runs dropped from something like 2 hours to 1 hour, as you’d expect.

Unfortunately since then most wins haven’t been nearly as dramatic, but still a happy user of flame graphs.

Sesse__8h ago
Do you really need flame graphs for that? Wouldn't any normal profiler tell you if a function and its children used 50% of your CPU?

I always struggle to see why people think flame graphs are so great, but I'm not sure if people are comparing them to a normal (non-graphical) profile or not.

manwe1506h ago
Flamegraphs sort the samples by location, rather than ordered by time. They also show hierarchy, rather than just leafs. All combinations on those two axis can be useful to present. Strictly speaking a normal profiler is probably one that gives leaf calls only in order, which is probably the least useful quadrant, but the fastest to generate (works better for hand annotated events and to see latency rather than time)
sgerenser4h ago
Probably could have done it without flame graphs, but the flame graphs made the problem incredibly obvious to anyone including non programmers. I was not originally on the project to work on performance per se, so I had to justify the work.
ferguess_k2h ago
Thanks for sharing. Can you please hint what is the purpose of that simulation application? Is it for stress testing Azure compute?
sgerenser1h ago
CPU/SoC performance modeling. It probably had a side effect of stress testing azure compute though. And yes, the irony of a performance modeling tool having terrible performance wasn’t lost on me. (Probably a result of the app mostly being written by people with a hardware engineering background, not software.)
sdevonoes9h ago
I struggle with measuring performance. I cannot run such tools in prod envs. Not even in dev envs, only locally. This is because only platform engs have prod access.

But everything usually looks fine on local env, and can’t really replicate the intricacies of prod locally. How do you guys do it?

BigRedEye1h ago
You can collect profiles from your production environment using some sort of continuous profiler, like Grafana Alloy or the OTel profiler. We actually built https://github.com/yandex/perforator specifically to profile everything we can reach.

This thing also greatly helps when exploring unfamiliar codebases. You can just open a flame graph in a few clicks and see what the program actually does.

muststopmyths9h ago
They should still be able to provide you with traces from prod even if you can't directly access the systems. Most of perf work is analyzing, not collecting.
d6755h ago
scripts got significantly faster using isoformat for parsing date times over str. These were critical recovery/startup scripts for an ultra low latency

no one ever bothered to look. a profile found it instantly

sightlinemac9h ago
On a live machine you have to start tracing before the slow run happens, and tracing has a cost, so you only get a few attempts. Here every recording already logs every context switch because the VM needs them to replay, so the off-CPU and wakeup analysis can be done afterwards, on any run. The hrtime test is a useful distinction too: it accounts for 3.38s of the critical path, but the sleep is intentional, so the drag you can actually remove is zero.

Worshipping at the altar of Brendan Gregg

Okay, I am the first to admit that I’m a bit manic with AI. When you are working on a problem that has endless possibilities, it is difficult to constrain yourself to a limited set of features.

Farid Zakaria’s Blog