7 ms·
Linux tracing systems and how they fit together
- equalunique 9y agoI should take it upon myself to get familiarized with all of these.
- ad_hominem 9y agoYou should get familiarized with HN commenting etiquette regarding low-effort comments
- 616c 9y agoI am a huge fan of jvns. I wish I can be her when I grow up. Does anyone know of someone doing the same style of introspection tools, for tracing and profiling and networking, like the body of her work, not just this post, but for Windows? I know a few scattered posts here and there, usually PFEs at Microsoft Blogs scattered, but the landscape of dedicated bloggers seems lacking to a novice like me.
- adamnemecek 9y agoETW might be what you are looking for.
- lowleveldesign 9y agoHave a look at Bruce Dawson blog [1] - he has written many articles explaining ETW and its tooling. You may start at the summary page [2] to check the covered topics. "Ask the perf team" blog [3] contains also a lot of interesting posts on Windows diagnostics, but unfortuantely is no longer updated. [1] https://randomascii.wordpress.com https://randomascii.wordpress.com [2] https://randomascii.wordpress.com/2015/09/24/etw-central/ https://randomascii.wordpress.com/2015/09/24/etw-central/ [3] https://blogs.technet.microsoft.com/askperf/ https://blogs.technet.microsoft.com/askperf/
- hannasm 9y agoVance Morrison is a pretty significant guy in the windows (.NET) tracing world https://blogs.msdn.microsoft.com/vancem/ https://blogs.msdn.microsoft.com/vancem/
- windowsworkstoo 9y agoYeh Vance is great and is largely responsible for getting a sensible wrapper for ETW in .NET
- 0xcde4c3db 9y agoI'm still not seeing the part where they actually fit together; it basically just looks like an accumulation of ad-hoc tools with no overarching concept. They look like they could be very useful tools, but there doesn't seem to be any architecture there.
- Mic92 9y agoThe answer is they don't fit well together. `perf-tools` is probably the most complete tool when it comes to number of performance counters, which be aggregated. However it is not well composable or extensible - so you have to use it as it is. I also find the code hard to read. `bcc` and `lttng` try to make things by creating a more usable API. They partially reuse the kernel part of `perf` (aka `perf_events`) and also add their own kernel modules to provide new functionality.
- cyphar 9y agoThere definitely isn't any overarching design. You see the same thing all throughout Linux's interfaces (containers are another great example). If you contrast this with the Solaris or BSD interfaces you notice that Linux has always been odd in this respect (DTrace, Jails/Zones, ZFS, pf, kqueue/eventports and so on). Depending on your view you can view this as a positive or a negative. One view is to say that Linux is more collaborative, and only the "common core" interfaces are actually put into the kernel (with the higher levels being provided in userspace by vendors). A good example of this is the live patching code that came from a distilling of Red Hat's ksplice and SUSE's kgraft systems. You can track done most of Linux's features to this sort of development model. illumos and BSD however, usually work far more like traditional software products. Some engineer goes off and implements a really interesting system that then gets put into a release. That's how ZFS, Jails, DTrace and so on were developed (in Sun) and I'm sure you can come up with other examples from BSD. The key point here is that this is a far more authoritarian model -- one set of engineers have decided on a system and developed it mostly in isolation. Linux doesn't permit that style of development because large patchsets need to be broken down over releases. Personally I must say that I don't care for the Linux style of things, mainly because I feel it hampers OS innovation in some ways. But the upside is that the facilities are more like libraries than frameworks and so you're forced to design your abstractions in userspace. Is that good? I don't know. Note that following along with the above theme, there is an overarching architecture for Linux's tracing tools (in userspace) in the form of bcc[1]. [1]: https://github.com/iovisor/bcc https://github.com/iovisor/bcc
- emilfihlman 9y agoYour pictures are broken?
- jvns 9y agoshould be fixed now (delightfully, I needed to get some new TLS certs for my site to fix this issue, and that took literally like 30 seconds to do thanks to the magic of Let's Encrypt)
- relyio 9y agoYou should mention it is the Ecole Polytechnique... de Montreal. Usually, when people say "Ecole Polytechnique" they mean the original one. It's like saying you went to MIT (Minnesota Institute of Technology). Other than this small nit, great article.
- _delirium 9y agoFwiw, in recent years the school has preferred the more distinctive name Polytechnique Montréal, rather than either École Polytechnique or École Polytechnique de Montréal, although there are plenty of materials not yet using the new branding.
- jvns 9y agofixed! I thought it was really cool that the DORSAL lab (http://www.dorsal.polymtl.ca/en http://www.dorsal.polymtl.ca/en) is doing such interesting and practical linux research -- I often think of academics as living 'up in the clouds', but it seemed like they were contributing a lot to the Linux kernel and building really useful tracing tools. So a bunch of people in academia are doing super practical systems work & writing papers about it and I think that's awesome. It made me want to read more academic systems papers. > Research done at the lab concentrates on improving the performance, reliability and resilience of distributed, cloud and multi-core systems.
- everybodyknows 9y agoFor those willing to get their hands dirty in low-level kernel code, the perhaps simplest tracing tool is dynamic-debug: https://github.com/torvalds/linux/blob/master/Documentation/admin-guide/dynamic-debug-howto.rst https://github.com/torvalds/linux/blob/master/Documentation/...
- notenoughdhh 9y agoI'm confused why BPF exists in the first place. Can't we just compile kernel modules that hook into the tracing infrastructure? It seems like a webassembly for the kernel but local software has the benefits of knowing the platform it is running on. I.e. Why compile C code to eBPF, when I can just compile to native code directly? I can potentially see it solving a permissions problem, where you want to give unprivileged users in a multi-tenant setup the ability to run hooks in the kernel. Is that actually a common use case? I don't think it is.
- dangisafascist 9y agoI'm confused why BPF exists in the first place. Can't we just compile kernel modules that hook into the tracing infrastructure? It seems like a webassembly for the kernel but local software has the benefits of knowing the platform it is running on. I.e. Why compile C code to eBPF, when I can just compile to native code directly? I can potentially see it solving a permissions problem, where you want to give unprivileged users in a multi-tenant setup the ability to run hooks in the kernel. Is that actually a common use case? I don't think it is.
- vbernat 9y agoYes, you can just compile kernel modules, but you take the risk of crashing the kernel. eBPF provides a safe way to interact with the kernel due to not being turing complete and additional restrictions. Systemtap is another example of such language but compiles to kernel modules instead. This is quite important when you want to run this code in production. You don't want to accidently crash your kernel.
- dangisafascist 9y agoI'm not sure this argument makes sense. Avoiding accidentally crashing the kernel doesn't require a BPF layer. For instance, you could just write your kernel module in a sufficiently safe language, like Rust, and have the same benefits. You could even pre-compile eBPF for the exact same level of safety. Still no need for the bpf() system call or the eBPF VM or JIT in the kernel.
- otterley 9y agoCan you give us an example of such a module?
- dangisafascist 9y agoI can but I don't see why that is necessary. It's plain to see that it's possible and performs better in production since it avoids the JIT step. https://github.com/tsgates/rust.ko https://github.com/tsgates/rust.ko
- bjackman 9y agoIn my team we use a tool we developed called TRAPpy [1] to parse the output of ftrace (and systrace) into Pandas DataFrames, which can then be plotted and used for rich analysis of kernel behaviour. We also integrate it into a rather large wider toolkit called LISA [2] which can do things like describe synthetic workloads, run them on remote targets, collect traces and then parse them with TRAPpy to analyse and visualise the kernel behavior. We mainly use it for scheduler, cpufreq and thermal governor development. It also does some automated testing. [1] https://github.com/ARM-software/trappy https://github.com/ARM-software/trappy [2] https://github.com/ARM-software/lisa https://github.com/ARM-software/lisa
- throwme_1980 9y agoI am not sure what to think of these pictures, it triviliases the entire subject and makes it look child like, no engineer worth his salt will be seen with these doodles on his desk. Stop reading as soon I saw that
- jhh 9y agoNo True Scotsman... I like the drawings. Cute, positive and informative. Superficial way to judge the content, too.
- scott_s 9y agoI guess I'm not worth my salt.
- darksim905 9y agono offense, but jvns is kind of known for her drawings & doodles that explain key concepts of a larger, confusing subject. They are awesome, to the point & great for digesting information we need to know, quickly.
- throwme_1980 9y agoKnown is relative ....
- DanBC 9y agoYou need to rethink. Many doctors will tell you how useful some colouring-in books were to them. Here's one example, but there are others: https://www.amazon.co.uk/Human-Brain-Coloring-Book-Concepts/dp/0064603067/ https://www.amazon.co.uk/Human-Brain-Coloring-Book-Concepts/... Richard Feynman said that if you wanted to quickly learn a subject you'd start with the books for children to get a quick overview.
- kronos29296 9y agoFor a guy who knows nothing about tracing, it was a post that made me understand atleast some of it. The doodles really made me smile instead of a boring flowchart or diagram using a drawing tool. Another post going to my collection of interesting posts.
- bitcharmer 9y agoI'm surprised Brendan Gregg hasn't been mentioned here yet. He's the Linux tracing/profiling god. http://www.brendangregg.com/linuxperf.html http://www.brendangregg.com/linuxperf.html Don't get me wrong, I respect Julia Evans as a professional, but what she mostly does is simplify other people's hard work and in-depth analysis of difficult problems in various layers of the technology stack.
- adultSwim 9y agoThis is why we can't have nice things :(
- deleted 9y ago[deleted]
- kevintb 9y ago> What she mostly does is simplify other people's hard work This is the opposite of "respecting" someone as a professional.
- kazinator 9y agoJulia mentions and links to Brendan Gregg four times in the this article.
- amagumori 9y agoi don't think that's what she does. i think she's the Bob Ross of Linux. what she does is to evangelize learning about low-level debugging / tracing tools and such to a wide audience, with a tone of "you can do this! it's ok if you're a novice". if all talented programmers understood and encouraged beginners like she did, we'd have an embarrassment of great programmers.
- dano 9y agoYes - this. I'm pleased that younger people in my team are learning things from her posts. Being a grey-hair *nix guy (not a grey beard!) the posts are interesting, but I know there is a LOT more beneath the surface. She's a valuable addition to the net!
- lma21 9y agoGreat article, sums up the linux tracing domain in a pretty neat way. I've used strace / perf / dtrace extensively since these are the only tools our clients' infrastructures can support, and it's always a bugger when you're on an older system and your hands are tied. Never tried eBPF yet, I should look into it once the kernel 4.7+ release hits RHEL