Skip to content
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

Adjustments to examples/softirq-latency-net-rx #349

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

netoptimizer
Copy link
Contributor

Making some adjustments to examples/softirq-latency-net-rx, prior to using this in prod.

(Related to PERF-1546)

Change names to better reflect what they are measuring.

Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Buckets with usec resolution isn't enough for wait time latency.
As we are loosing important variations in data.

Increase resolution to nanosec also avoids a division (in this fastpath).

Did a quick test modifying softirq_net_latency.bt bpftrace script
to illustrate prod data:

@latency_usecs[40]: 
[0]               200126 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[1]                67007 |@@@@@@@@@@@@@@@@@                                   |
[2, 4)              6604 |@                                                   |
[4, 8)              4856 |@                                                   |
[8, 16)             4641 |@                                                   |
[16, 32)            3753 |                                                    |
[32, 64)            1438 |                                                    |
[64, 128)            409 |                                                    |
[128, 256)            78 |                                                    |
[256, 512)            39 |                                                    |
[512, 1K)             16 |                                                    |
[1K, 2K)               9 |                                                    |
[2K, 4K)              10 |                                                    |
[4K, 8K)               1 |                                                    |
[8K, 16K)              0 |                                                    |
[16K, 32K)             1 |                                                    |

@latency_ns[40]: 
[128, 256)          1391 |                                                    |
[256, 512)         50599 |@@@@@@@@@@@@@@@@@                                   |
[512, 1K)         153410 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[1K, 2K)           62050 |@@@@@@@@@@@@@@@@@@@@@                               |
[2K, 4K)            6486 |@@                                                  |
[4K, 8K)            4804 |@                                                   |
[8K, 16K)           4675 |@                                                   |
[16K, 32K)          3648 |@                                                   |
[32K, 64K)          1392 |                                                    |
[64K, 128K)          386 |                                                    |
[128K, 256K)          72 |                                                    |
[256K, 512K)          39 |                                                    |
[512K, 1M)            15 |                                                    |
[1M, 2M)              10 |                                                    |
[2M, 4M)               9 |                                                    |
[4M, 8M)               1 |                                                    |
[8M, 16M)              0 |                                                    |
[16M, 32M)             1 |                                                    |

Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
This avoids hooking 'softirq_exit' as it can be expensive and for NET_RX
this isn't the right hook as runtime is affected by NAPI packet bulking.

Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
examples/softirq-latency-net-rx.bpf.c Outdated Show resolved Hide resolved
examples/softirq-latency-net-rx.bpf.c Outdated Show resolved Hide resolved
examples/softirq-latency-net-rx.bpf.c Show resolved Hide resolved
@netoptimizer netoptimizer force-pushed the softirq-latency01 branch 2 times, most recently from 0454ab2 to d52ae51 Compare February 21, 2024 16:32
@bobrik bobrik merged commit 4c0fd8e into cloudflare:master Feb 21, 2024
18 checks passed
netoptimizer added a commit to xdp-project/xdp-project that referenced this pull request Feb 27, 2024
The histograms need to have higher resolution than usec.

Buckets with usec resolution isn't enough for wait time latency.
As we are loosing important variations in data.

Increase resolution to nanosec also avoids a division (in this fastpath).

Did a quick test modifying softirq_net_latency.bt bpftrace script
to illustrate prod data:

@latency_usecs[40]: 
[0]               200126 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[1]                67007 |@@@@@@@@@@@@@@@@@                                   |
[2, 4)              6604 |@                                                   |
[4, 8)              4856 |@                                                   |
[8, 16)             4641 |@                                                   |
[16, 32)            3753 |                                                    |
[32, 64)            1438 |                                                    |
[64, 128)            409 |                                                    |
[128, 256)            78 |                                                    |
[256, 512)            39 |                                                    |
[512, 1K)             16 |                                                    |
[1K, 2K)               9 |                                                    |
[2K, 4K)              10 |                                                    |
[4K, 8K)               1 |                                                    |
[8K, 16K)              0 |                                                    |
[16K, 32K)             1 |                                                    |

@latency_ns[40]: 
[128, 256)          1391 |                                                    |
[256, 512)         50599 |@@@@@@@@@@@@@@@@@                                   |
[512, 1K)         153410 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[1K, 2K)           62050 |@@@@@@@@@@@@@@@@@@@@@                               |
[2K, 4K)            6486 |@@                                                  |
[4K, 8K)            4804 |@                                                   |
[8K, 16K)           4675 |@                                                   |
[16K, 32K)          3648 |@                                                   |
[32K, 64K)          1392 |                                                    |
[64K, 128K)          386 |                                                    |
[128K, 256K)          72 |                                                    |
[256K, 512K)          39 |                                                    |
[512K, 1M)            15 |                                                    |
[1M, 2M)              10 |                                                    |
[2M, 4M)               9 |                                                    |
[4M, 8M)               1 |                                                    |
[8M, 16M)              0 |                                                    |
[16M, 32M)             1 |                                                    |

Similar change as ebpf-exporter PR:
 cloudflare/ebpf_exporter#349

Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants