Note
|
For the best reading experience, please view this documentation at elastic.co |
There are many options available to tune agent performance. Which option to adjust depends on whether you are optimizing for speed, memory usage, bandwidth or storage.
The first knob to reach for when tuning the performance of the agent is [config-transaction-sample-rate].
Adjusting the sample rate controls what percent of requests are traced.
By default, the sample rate is set at 1.0
, meaning all requests are traced.
The sample rate will impact all four performance categories, so simply turning down the sample rate is an easy way to improve performance.
Here’s an example of setting the sample rate to 20% using [configuration-on-asp-net-core]:
{
"ElasticApm": {
"TransactionSampleRate": 0.2
}
}
In a complex application, a request may produce many spans. Capturing a stack trace for every span can result in significant memory usage. Stack traces are also captured for every error. There are several settings to adjust how stack traces are captured.
To disable capturing stack traces (for both spans and errors),
set StackTraceLimit
to 0
.
In its default settings,
the APM agent collects a stack trace for every recorded span with duration longer than 5ms.
To increase the duration threshold,
set SpanFramesMinDuration
.
The StackTraceLimit
controls how many stack frames should be collected
when a capturing stack trace.
Capturing HTTP request and response headers increases memory allocations,
network bandwidth and disk space used by Elasticsearch.
To disable capturing HTTP request and response headers,
set CaptureHeaders
to false
.
The .NET agent tracks certain system and application metrics.
These metrics are regularly collected and sent to the APM Server and from there to Elasticsearch.
You can adjust the interval for metrics collection with the setting MetricsInterval
.