bpf-examples icon indicating copy to clipboard operation
bpf-examples copied to clipboard

trie-free-latency: Demo showing the latency of freeing LPM_TRIE maps

Open mfleming opened this issue 5 months ago • 2 comments

The performance of freeing LPM_TRIE maps suffers heavily for maps with a large number of entries. Here's a little demo that measures the duration of trie_free() and allows the user to control how many entries are in the map, as well as how many iterations of the demo are run to collect latency statistics.

This is a reproduction of an issue we've seen at Cloudflare and a public demo to aid with the upstream discussion at https://lore.kernel.org/lkml/[email protected]/

mfleming avatar Jun 24 '25 12:06 mfleming

Thanks for working on this "homework" assignment ;-)

netoptimizer avatar Jun 24 '25 15:06 netoptimizer

I'm considering if we should rename the example director trie-free-latency

  • to something with LPM in the name, to make the connection with the BPF_MAP_TYPE_LPM_TRIE

What about these proposals:

  • LPM-map-tests or LPM-map-bench

I'm considering adding another example in this directory that can monitor the runtime performance/latency of LPM map lookups

  • I already have a bpftrace script, that measures lookup latency, but it added too much overhead (to production)
  • Thus, I want to write a C/BPF version with minimal overhead

netoptimizer avatar Jun 26 '25 15:06 netoptimizer

Thanks for addressing everything - going to merge

netoptimizer avatar Jul 04 '25 14:07 netoptimizer