eBPF Testing
Keploy uses to capture every API call, database query and service interaction at the kernel level, and turns them into tests and mocks: eBPF API testing with zero code changes, zero proxies, zero SDKs.
On Apple Silicon Macs and Windows, Keploy also records natively without eBPF for Go, Node.js, Python and Java apps. You choose where recording runs, such as a local machine, CI or a staging namespace.
- Every API call, query and message captured
- No SDKs, no proxies, no code changes
- Works with any language on Linux
eBPF capture: Keploy attaches eBPF probes to the kernel socket system calls, copies every request and dependency call that crosses the kernel, and decodes them into test cases and mocks.
Step 1 of 3: Attach probes
Why eBPF for Testing
The testing industry spent two decades building tools that require application changes. eBPF removes all of these requirements.
How Keploy Uses eBPF for API Testing
Most eBPF tools are built for tracing and security. Keploy is an open-source eBPF testing tool, built for record and replay testing, with flaky test detection built in.
Keploy's eBPF code is open source on GitHub. To run it in CI, see executing eBPF in GitHub Actions.
eBPF vs Sidecar Proxy vs SDK
Three approaches to capturing traffic for testing, each at a different layer of the stack.
eBPF (Keploy)
Sidecar proxy
Capture layer
Code changes
Protocol visibility
Performance overhead
Language support
eBPF Testing in Kubernetes
Every pod on a node shares that node's Linux kernel, so eBPF can observe any container's traffic without changing its image. That makes eBPF on k8s a natural fit for recording real service traffic.
One kernel per node
Pods on a node share its Linux kernel, so Kubernetes eBPF capture works for every language and base image, with no image rebuilds or injected libraries.
Scoped to the pods you record
A node agent loads the eBPF programs and filters capture by the target pods' PIDs and cgroups. You choose the namespace, such as staging or a sandbox.
Node agent or sidecar
Keploy runs as a DaemonSet node agent by default, or injects a sidecar agent into your pod when the DaemonSet is turned off.
Protocol Support and Wire-Level Capture
eBPF captures raw bytes. Keploy's protocol decoders parse them into structured, human-readable test cases and mocks.
HTTP APIs
HTTP/1.1 and HTTP/2: method, path, headers, body and status code.
RPC
gRPC: service, method, and request and response protobufs.
SQL databases
PostgreSQL and MySQL: query text, parameters and result sets.
NoSQL databases
MongoDB and Redis: commands, keys, documents and responses.
Message queues
Kafka: topic, partition, key and message payload.
GraphQL
GraphQL over HTTP: query, variables and response data.
This protocol breadth enables full dependency mocking. When Keploy records a test for an HTTP endpoint that queries PostgreSQL and calls a downstream gRPC service, the resulting test includes mocks for both. No live database or downstream service is needed during replay.
Performance Overhead Analysis
eBPF's low overhead comes from its execution model: programs are JIT-compiled to native machine code and run in a sandboxed context within the kernel. Data is buffered in kernel ring buffers and drained to user space asynchronously.
For most teams, we recommend recording in staging, where the small recording overhead does not affect users. During replay in CI/CD there is no production overhead, since tests run against recorded data. Overhead depends on your workload, so measure it on your own services.
Recording overhead
Where each approach adds work. Relative, not a benchmark.
Limitations and Considerations
eBPF-based testing is powerful but not without constraints. Transparency helps teams make informed decisions.
Linux Only
eBPF is a Linux kernel technology: macOS has no eBPF, and eBPF for Windows is a separate, still-maturing Microsoft project. On Apple Silicon Macs and Windows, Keploy records natively for Go, Node.js, Python and Java apps (HTTP/HTTPS, MySQL and MongoDB decoded). Other setups run Keploy inside Docker or WSL. CI/CD on Linux runs natively.
Kernel Version Requirements
Keploy needs Linux kernel 5.10 or higher. Ubuntu 22.04+, Debian 11+ and Amazon Linux 2023 meet this. To check if eBPF is enabled, run uname -r and grep CONFIG_BPF /boot/config-$(uname -r): CONFIG_BPF=y and CONFIG_BPF_SYSCALL=y mean it is on.
TLS-Encrypted Traffic
For eBPF TLS capture, Keploy attaches uprobes to TLS library functions (SSL_write, SSL_read) to read data before encryption and after decryption, which works transparently for most applications.
Privileged Access
Loading eBPF programs requires elevated privileges (root or CAP_BPF). CI/CD containers run as root by default. eBPF programs are kernel-verified and sandboxed.
FAQs
Give every change a verified
Digital Twin
Verify human- or AI-written code against real production behavior — deterministic tests, mocks, and production-like sandboxes, before it ships.
Need Resources?
Read DocumentationIntegration Testing Simplified
Start With Keploy Open SourceNeed Further Assistance?
Talk To Our Team On SlackJoin our GlobalCommunity
Connect with developers worldwide. Follow updates, ask questions, share feedback, and ship faster with other Keploy builders.
“Best report of integration and API tests I've seen — which we don't get from RestAssured.”
G2“Future of microservices testing. I don't write tests now!”
Mahfooz A. · G2 · 5/5“An amazing product that simplifies the automation.”
Gartner · 4.0