Skip to content

Resize eBPF maps at configuration time #1287

@pinoOgni

Description

@pinoOgni

UPDATE

While I was looking through the code, I found this TODO there, all alone, and I thought it needed attention. :)

As discussed in the SIG, resize eBPF maps at configuration time can be useful for various reasons (such as memory efficiency because static large maps may be smaller in some cases and so on).

How much freedom does the user need? (Update after internal discussion)

The User can potentially modify all maps. We can expose some functional dimensions in the configuration, something like:

  • capacity: max_concurrent_requests, max_custom_spans and so on. Divided by maps.
  • multiplier (as suggested by @florianl) to scale the dimensions by a factor (e.g., 0.5x for some cases and 2x for others). Profiler reference

Linked maps

Some maps could be mathematically linked. For example, if we increase map A, map B must grow proportionally. In this case we can give the possibility to the user to configure only the "Parent" dimension, and we calculate automatically the "Child" map sizes to ensure internal consistency.

Work done and next steps

I already did something. Right now, during loading, change the size of all maps with max_entries of the following values: MAX_CONCURRENT_REQUESTS, MAX_CONCURRENT_SHARED_REQUESTS, and MAX_CONCURRENT_CUSTOM_SPANS.
Maps are divided by tracer. Each tracer must define the size they want for each map. The use can do:

ebpf:
  map_sizes:
    max_concurrent_requests: 9999
    ...

Note: there are maps shared between various tracers (even if they're perhaps not used, for example, listening_ports between tpinjector and `generictracer). This could be solved by cleaning up the ebpf code and making each tracer only use its own things or common data structures but not those of another.

If we agree on the approach, I can open a draft PR implementing these changes so we can discuss the implementation details there.

WIP solution:

ebpf:
    map_sizes:
         - listening_ports:
             max_entries: <size or multiplier>
         - kafka_state:
            max_entries: <size or multiplier>

FYI @rafaelroquetto @grcevski

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions