Wiki: The Next Linux Superpower: eBPF Primer

For agents: Markdown version · Wiki index · Explore

Written by an LLM from machine transcripts. It can contain errors. Check the transcript before you quote it.

Summary

The speaker introduces eBPF and the BPF Compiler Collection (BCC) as powerful, modern Linux tracing and monitoring technologies. The presentation covers how eBPF safely executes verified bytecode inside the kernel for high-performance packet filtering and event tracing. Additionally, the speaker demonstrates various built-in tools and custom scripts for capturing system performance metrics with minimal overhead. The audience learns how to leverage kernel and user-space probes to diagnose complex software and operating system issues.

Key points

  • 1:03 The speaker outlines the scope of Linux tracing and compares existing tools on axes of power and usability.
  • 3:22 Berkeley Packet Filters (BPF) originated for packet filtering and evolved with a JIT compiler for high performance.
  • 4:29 BPF programs are verified to be safe, preventing infinite loops and random memory corruption inside the kernel.
  • 6:36 The BPF Compiler Collection (BCC) simplifies writing BPF programs in C and attaching them via Python or Lua scripts.
  • 9:57 Unlike traditional tools like Perf, BPF performs data aggregation directly inside the kernel to reduce overhead and disk writes.
  • 16:36 BPF programs can attach to kernel functions (Kprobes), user-space functions (Uprobes), and static tracepoints.
  • 21:56 General-purpose tracing tools allow developers to collect histograms and filter events based on specific conditions or arguments.
  • 30:19 Writing custom BCC tools involves combining a C handler function compiled to BPF bytecode with a Python driver script.

Takeaways

  • Use eBPF-based tools to perform in-kernel event aggregation, significantly reducing performance overhead compared to traditional tracing methods.
  • Attach Kprobes and Uprobes dynamically to kernel and user-space functions without requiring application restarts.
  • Leverage existing BCC utility scripts for common diagnostic tasks like tracking memory leaks, disk I/O latency, and file system cache performance.

Questions this talk answers

  • How does eBPF ensure that running custom bytecode inside the kernel will not crash the system?
  • What is the difference between BPF and BCC, and how do they work together?
  • Why is in-kernel data aggregation more efficient for performance monitoring than collecting raw events in user space?

Technologies

Linux, Python, Lua, C, Java, Node.js, Ruby

Tags

debugging, ebpf, linux kernel, networking, performance monitoring, tracing