BCC — eBPF Tracing and Performance Analysis Tools for Linux
A toolkit for creating efficient kernel tracing and manipulation programs using eBPF. BCC includes over 100 ready-to-use tools for performance analysis, networking, and security observability on Linux systems.
Instalación lista para agent
Este activo puede instalarse después de elegir el runtime, revisar el plan y ejecutar el comando correspondiente.
npx -y tokrepo@latest install 5abb7410-398f-11f1-9bc6-00163e2b0d79 --target codexEjecutar después de confirmar el plan con dry-run.
What it is
BCC (BPF Compiler Collection) is a toolkit for creating and using eBPF tracing programs on Linux. It includes over 100 ready-to-use tools for performance analysis, networking debugging, and security observability: trace new process execution, monitor file opens, measure disk I/O latency, sniff DNS queries, and more. All without kernel module compilation or system restarts.
BCC targets SREs, performance engineers, kernel developers, and security teams who need deep visibility into Linux system behavior at the kernel level.
How it saves time or tokens
Traditional Linux debugging involves combining strace, perf, tcpdump, and custom scripts. Each tool covers one dimension. BCC provides purpose-built tools that answer specific questions immediately: which processes are consuming the most disk I/O, what syscalls are failing, which TCP connections have high latency. One command gives you answers that would take multiple tools and post-processing scripts.
How to use
- Install BCC tools:
sudo apt-get install bpfcc-tools linux-headers-$(uname -r)
- Run built-in tools (requires root):
sudo execsnoop-bpfcc # Trace new process execution
sudo opensnoop-bpfcc # Trace file opens
sudo biolatency-bpfcc # Disk I/O latency histogram
sudo tcpconnect-bpfcc # Trace TCP connections
- Each tool outputs real-time data. Use Ctrl+C to stop and see summaries.
Example
# Find which processes are doing the most disk I/O
sudo biotop-bpfcc
# Trace DNS queries
sudo dnssnoop-bpfcc
# Measure function latency in a running process
sudo funclatency-bpfcc -p $(pidof myapp) 'malloc'
# Count syscalls by process
sudo syscount-bpfcc -p $(pidof nginx)
Each command provides kernel-level insights with minimal overhead.
Related on TokRepo
- Monitoring Tools -- System observability and monitoring tools
- Security Tools -- Security analysis and observability
Common pitfalls
- BCC tools require root access and kernel headers. Missing kernel headers is the most common installation failure. Ensure
linux-headers-$(uname -r)is installed. - eBPF programs run in kernel space. A buggy custom eBPF program can impact system stability. Stick to the pre-built tools unless you understand eBPF verification.
- BCC has higher startup overhead than bpftrace because it compiles BPF programs at runtime. For frequently run tools, consider pre-compiled alternatives.
Preguntas frecuentes
BCC works on Linux kernels 4.1+ with eBPF support. Most modern distributions (Ubuntu 18.04+, RHEL 8+, Debian 10+) include eBPF support. Older kernels may lack required eBPF features.
BCC provides Python and Lua APIs for writing eBPF programs plus 100+ pre-built tools. bpftrace is a higher-level tracing language for one-liners. Use BCC tools for ready-made analysis; use bpftrace for custom ad-hoc queries.
eBPF programs add minimal overhead because they run in the kernel with JIT compilation. The overhead is typically less than 1% for most tracing tools. However, high-frequency tracepoints can add measurable cost.
Yes. BCC provides Python and C APIs for writing custom eBPF programs. You write the eBPF code in C (runs in kernel) and the control logic in Python (runs in userspace).
Yes. The pre-built BCC tools are widely used in production at major companies. The eBPF verifier in the kernel ensures programs cannot crash the system. Always test custom tools in staging first.
Referencias (3)
- BCC GitHub— 100+ eBPF tracing tools for Linux
- eBPF Documentation— eBPF technology for kernel tracing
- Brendan Gregg BPF Tools— Linux performance analysis with BPF tools
Relacionados en TokRepo
Discusión
Activos relacionados
bpftrace — High-Level Tracing Language for Linux eBPF
A high-level tracing language for Linux that uses eBPF to instrument the kernel and user-space programs. Write powerful one-liner performance analysis scripts with an awk-like syntax that compiles to eBPF bytecode.
Kyanos — eBPF Network Analysis and Troubleshooting Tool
A networking analysis tool using eBPF that visualizes kernel-level packet timing and captures request/response pairs for efficient troubleshooting.
Cilium — eBPF-Powered Cloud Native Networking & Security
Cilium provides high-performance networking, observability, and security for Kubernetes using eBPF. CNI plugin, service mesh, and network policy — all kernel-level.
Tracee — eBPF Runtime Security and Forensics for Linux
Tracee by Aqua Security uses eBPF to trace system events at the OS level, detecting suspicious behavior in containers and hosts for runtime security and forensics.