Skip to content

Latest commit

 

History

History
82 lines (63 loc) · 2.84 KB

performance-tuning.asciidoc

File metadata and controls

82 lines (63 loc) · 2.84 KB
Note
For the best reading experience, please view this documentation at elastic.co

Performance tuning

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.

Sampling

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
    }
}

Stack traces

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.

Disable capturing stack traces

To disable capturing stack traces (for both spans and errors), set StackTraceLimit to 0.

Capture stack traces only for long running spans

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.

Reduce number of captured stack trace frames

The StackTraceLimit controls how many stack frames should be collected when a capturing stack trace.

Disable capturing HTTP request and response headers

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.

Increase metrics collection interval

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.