-
Notifications
You must be signed in to change notification settings - Fork 18
feat: eBPF event deduplication before CEL rule evaluation #762
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e1cdc49
feat: eBPF event deduplication before CEL rule evaluation
slashben 0de1bad
docs: add dedup benchmark results with CPU/memory plots
slashben c9e3d43
ci: add automated performance benchmark workflow
slashben 450e497
fix: address review comments on eBPF event dedup
slashben bf98150
merge: resolve conflict with main (pprof.Do wrapper)
slashben 4041122
fix: benchmark namespace race and profile dedup regression
slashben 97915ef
Merge remote-tracking branch 'origin/main' into feature/ebpf-event-de…
slashben e2ab103
fix: add ReportDedupEvent to MetricsNoop after merge with main
slashben bd1915b
fix: preload load-simulator image into kind to avoid pull timeouts
slashben 1f4c370
feat: add performance degradation quality gate to benchmark
slashben a9cff2f
fix: restore containerProfileAdapter in dedupSkipSet for CPU savings
slashben c99a266
ci: add workflow_dispatch to benchmark for manual runs
slashben ceb185a
docs: update benchmark results with CI vs local comparison
slashben File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # eBPF Event Dedup Benchmark Results | ||
|
|
||
| Benchmark comparing `node-agent:v0.3.71` (baseline) vs the local build with the dedup cache (`feature/ebpf-event-dedup`). | ||
|
|
||
| ## Setup | ||
|
|
||
| - **Cluster**: kind (2 nodes: control-plane + worker) | ||
| - **Prometheus**: kube-prometheus-stack with 10s scrape interval | ||
| - **Kubescape**: kubescape-operator chart with runtimeDetection + runtimeObservability enabled | ||
| - **Load simulator**: DaemonSet generating events at configurable rates | ||
| - **Duration**: 2 min warmup + 10 min load per run | ||
| - **CPU rate window**: `rate(...[1m])` for responsive measurement | ||
|
|
||
| ### Load Simulator Config | ||
|
|
||
| | Parameter | Value | | ||
| |-----------|-------| | ||
| | openRate | 1000/sec | | ||
| | httpRate | 100/sec | | ||
| | execRate | 10/sec | | ||
| | networkRate | 10/sec | | ||
| | dnsRate | 2/sec | | ||
| | hardlinkRate | 10/sec | | ||
| | symlinkRate | 10/sec | | ||
| | cpuLoadMs | 500 | | ||
| | numberParallelCPUs | 2 | | ||
|
|
||
| ## Resource Usage | ||
|
|
||
| | Metric | BEFORE (v0.3.71) | AFTER (dedup) | Delta | | ||
| |--------|-------------------|---------------|-------| | ||
| | Avg CPU (cores) | 0.178 | 0.150 | **-15.9%** | | ||
| | Peak CPU (cores) | 0.220 | 0.156 | **-29.1%** | | ||
| | Avg Memory (MiB) | 339.5 | 335.9 | -1.1% | | ||
| | Peak Memory (MiB) | 345.5 | 338.4 | -2.1% | | ||
|
|
||
| ### CPU Usage | ||
|
|
||
| | BEFORE (v0.3.71) | AFTER (dedup) | | ||
| |---|---| | ||
| |  |  | | ||
|
|
||
| ### Memory Usage | ||
|
|
||
| | BEFORE (v0.3.71) | AFTER (dedup) | | ||
| |---|---| | ||
| |  |  | | ||
|
|
||
| ## Dedup Effectiveness | ||
|
|
||
| Events processed by the dedup cache during the AFTER run: | ||
|
|
||
| | Event Type | Passed | Deduped | Dedup Ratio | | ||
| |------------|--------|---------|-------------| | ||
| | http | 1,701 | 119,453 | **98.6%** | | ||
| | network | 900 | 77,968 | **98.9%** | | ||
| | open | 59,569 | 626,133 | **91.3%** | | ||
| | syscall | 998 | 1,967 | **66.3%** | | ||
| | dns | 1,197 | 0 | 0.0% | | ||
| | hardlink | 6,000 | 0 | 0.0% | | ||
| | symlink | 6,000 | 0 | 0.0% | | ||
|
|
||
| ## Event Counters (cumulative, both runs) | ||
|
|
||
| | Metric | BEFORE | AFTER | | ||
| |--------|--------|-------| | ||
| | open_counter | 801,868 | 816,637 | | ||
| | network_counter | 92,197 | 93,735 | | ||
| | exec_counter | 7,009 | 7,130 | | ||
| | syscall_counter | 3,628 | 3,735 | | ||
| | dns_counter | 1,401 | 1,422 | | ||
| | capability_counter | 9 | 9 | | ||
|
|
||
| Event counters are consistent between runs, confirming the load simulator produced comparable workloads. | ||
|
|
||
| ## Analysis | ||
|
|
||
| - The dedup cache reduces **avg CPU by ~16%** and **peak CPU by ~29%** under sustained load (~1,100 events/sec). | ||
| - Memory impact is negligible (~1%) since the dedup cache uses a fixed-size, lock-free array (2 MiB for 2^18 slots at 8 bytes each). | ||
| - High-frequency event types benefit most: **network (98.9%)**, **http (98.6%)**, and **open (91.3%)** dedup ratios. | ||
| - Events with unique keys per occurrence (dns, hardlink, symlink) show 0% dedup, which is expected. | ||
| - The CPU savings come from skipping CEL rule evaluation on deduplicated events. The eBPF ingestion and event enrichment cost (which dominates baseline CPU) is unchanged. | ||
|
|
||
| ## Reproducing | ||
|
|
||
| ```bash | ||
| cd perfornamce | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
| ./dedup-bench.sh quay.io/kubescape/node-agent:v0.3.71 quay.io/kubescape/node-agent:test | ||
| ``` | ||
|
|
||
| Requires: kind, helm, kubectl, docker, python3. Estimated runtime: ~35 minutes. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.