Performance tuning
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes. The Elastic APM .NET agent enables you to trace the execution of operations in your .NET applications, sending performance metrics and errors to the Elastic APM server. Availability This functionality is generally available and ready for production usage. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless Observability
Generally available
Stack
Generally available
APM Agent .NET
Generally available
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 TransactionSampleRate. 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 might 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 deactivate capturing stack traces (for both spans and errors), set StackTraceLimit to 0.
In its default settings, the APM .NET Agent collects a stack trace for every recorded span with duration longer than 5ms. To increase the duration threshold, set SpanStackTraceMinDuration.
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 deactivate 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.