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
Remove the `i.activeMu` from the modelindexer and shared sync primitives
from the indexer structure, instead, run the active indexer in its own
goroutine, minimizing the amount of shared locking that needs to happen
when `ProcessBatch` is called. To allow (potentially) multiple active
indexers from running in parallel, a new internal `bulkItems` channel is
introduced, with a variable buffer depending on how powerful the machine
where APM Server is run. The bigger the machine, the bigger the channel
buffer, and vice versa.
Additionally, the default `FlushBytes` reduced from `5MB` to `2MB`, and
to keep the same total "bufferable" size, the default `MaxRequests` is
increased to 25 (25 * 2mb = 50mb). The motivation behind this change is
is twofold; Allowing the modelindexer to have more background flushes
if enough events are being processed by the APM Server, and, creating
slightly smaller bulk requests to Elasticsearch, since, with the default
settings (5MB FlushBytes), the number of bulk documents is ~`18-24K`.
Initial micro-benchmarks indicate that the performance improvement is
~42% with default settings, and macro-benchmarks ~27%:
```
benchstat old.txt single-lockless.txt
name old time/op new time/op delta
NoCompression-8 1.11µs ± 1% 1.15µs ± 4% +4.41% (p=0.008 n=5+5)
BestSpeed-8 2.03µs ± 3% 1.88µs ± 1% -7.14% (p=0.008 n=5+5)
DefaultCompression-8 4.10µs ± 2% 2.36µs ± 2% -42.32% (p=0.008 n=5+5)
BestCompression-8 6.95µs ± 1% 4.21µs ± 1% -39.48% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
NoCompression-8 2.07kB ± 0% 2.14kB ± 0% +3.44% (p=0.016 n=4+5)
BestSpeed-8 2.57kB ± 0% 2.56kB ± 0% -0.31% (p=0.008 n=5+5)
DefaultCompression-8 2.55kB ± 0% 2.52kB ± 0% -0.87% (p=0.008 n=5+5)
BestCompression-8 2.58kB ± 0% 2.57kB ± 0% -0.52% (p=0.008 n=5+5)
```
```
name old events/sec new events/sec delta
AgentAll-512 26.8k ± 0% 34.1k ±11% +27.11% (p=0.100 n=3+3)
```
Signed-off-by: Marc Lopez Rubio <marc5.12@outlook.com>
0 commit comments