You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[8.19](backport #48296) libbeat: memoize asset decoding per beat (#48376)
* libbeat: memoize asset decoding per beat (#48296)
Asset decoding is an expensive operation that happens during Beat
initialization. For standalone beats it runs only once at startup, so the cost
is amortized over the execution time.
For Beats receivers, multiple beat instances can be started by the
collector in the same process, delaying startup.
Since asset data is static per beat, decoded assets can be reused if the same
Beat was already initialized.
This change adds a global asset cache protected by a mutex,
ensuring each Beat is decoded only once, with subsequent instances
reading from the cache. This works because we only set fields in the registry
during program initialization, so calls to GetFields are immutable per beat.
While at it, cache the fqdn resolution that takes a significant portion
of the remaining cpu time.
Real collector (oteltestcol with 4 filebeat receivers) benchmarks
Measured time to first log ingested:
sec/op
46.01m ± 2% 10.74m ± 1% -76.67%
B/op
47.694Mi ± 0% 5.186Mi ± 4% -89.13%
allocs/op
49.82k ± 0% 39.22k ± 0% -21.28%
(cherry picked from commit aa318d4)
# Conflicts:
# libbeat/asset/registry.go
* fix conflicts
---------
Co-authored-by: Mauri de Souza Meneguzzo <mauri870@gmail.com>
0 commit comments