How to find slow methods
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 Java agent enables you to trace the execution of operations in your Java 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 Java
Generally available
Identifying a problematic service is only half of the battle when diagnosing application slowdowns. Luckily, the Elastic APM Java Agent provides multiple ways to get method-level insights into your code. This can help you diagnose slow requests due to heavy computations, inefficient algorithms, or similar problems not related to interactions between services.
Find out which part of your code is making your application slow by periodically recording running methods with a sampling-based profiler.
Very low overhead.
No code changes required.
Does not work on Windows and on OpenJ9.
The duration of profiler-inferred spans are not exact measurements, only estimates.
Use the API or OpenTracing bridge to manually create spans for methods of interest.
Most flexible.
Incorrect API usage may lead to invalid traces (scope leaks).
Annotations can be placed on top of methods to automatically create spans for them.
Easier and more robust than the API.
Less flexible on its own, but can be combined with the API.
Use a configuration option to specify additional methods to instrument.
No need to modify source code.
Possible to monitor code in third-party libraries.
Match methods via wildcards.
Easy to overuse which hurts runtime and startup performance.