Skip to content

Revisit docappender config autosizing values #13285

Closed
@kruskall

Description

@kruskall

We use some heuristic to adjust the max buffer size, max decoder size and max requests.

func maxConcurrentDecoders(memLimitGB float64) uint {
// Allow 128 concurrent decoders for each 1GB memory, limited to at most 2048.
const max = 2048
// Use 80% of the total memory limit to calculate decoders
decoders := uint(128 * memLimitGB * 0.8)
if decoders > max {
return max
}
return decoders
}

func docappenderConfig(
opts docappender.Config, memLimit float64, logger *logp.Logger,
) docappender.Config {
const logMessage = "%s set to %d based on %0.1fgb of memory"
// Use 80% of the total memory limit to calculate buffer size
opts.DocumentBufferSize = int(1024 * memLimit * 0.8)
if opts.DocumentBufferSize >= 61440 {
opts.DocumentBufferSize = 61440
}
logger.Infof(logMessage,
"docappender.DocumentBufferSize", opts.DocumentBufferSize, memLimit,
)
if opts.MaxRequests > 0 {
logger.Infof("docappender.MaxRequests set to %d based on config value",
opts.MaxRequests,
)
return opts
}
// This formula yields the following max requests for APM Server sized:
// 1 2 4 8 15 30
// 10 12 14 19 28 46
maxRequests := int(float64(10) + memLimit*1.5)
if maxRequests > 60 {
maxRequests = 60
}
opts.MaxRequests = maxRequests
logger.Infof(logMessage,
"docappender.MaxRequests", opts.MaxRequests, memLimit,
)
return opts
}

This formulas are really old and we had a lot of improvements since then, we should revisit them to ensure we are not underutilizing apm-server

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions