Ruby (https://github.com/elastic/apm-agent-ruby) - JS Beta (https://github.com/elastic/apm-agent-js-base) - Go Beta (https://github.com/elastic/apm-agent-go) - Java Beta (https://github.com/elastic/apm-agent-java) All agents are Open Source and available on GitHub
API ‒ Spring Web MVC/Spring Boot ‒ JDBC • Application Servers/Servlet Containers ‒ Tomcat ‒ WildFly ‒ Jetty ‒ WebSphere ‒ Spring Boot with embedded Tomcat, Jetty and Undertow • Participate in the survey
Java agents can modify classes when they are loaded • When Java load a Servlet class ‒ Agents adds code before and after Servlet#service ‒ Record Transactions (URL, parameters, response code) ‒ Send to APM Server
HTTP traffic for Servlet API-based applications ‒ JDBC queries • Offers API for customization ‒ Application specific metadata ‒ Custom transactions ‒ OpenTracing integration The best of both worlds
and one JDBC query • Response Time Overhead ‒ > 1 µs on average (0.000001s) ‒ ~ 3.5 µs for the 99.9th percentile • Allocation Overhead ‒ ~ 75 bytes per operation ‒ It takes ~14 000 operations to allocate 1 MB • Benchmarks are Open Source, feel free to challenge me on them
• Results are indexed in Elasticsearch • Kibana dashboard to analyze results • Benchmarks are executed on a dedicated machine ‒ No noisy neighbours • Intel Core i7-7700 CPU @ 3.60GHz
built into Hotspot VM • Free in test environments -XX:+UnlockCommercialFeatures • Very low overhead, even in microbenchmarks • Track down allocations ‒ Grouped by class ‒ Stack trace for source of allocation • Eliminate allocations ‒ Recycle/reuse objects ‒ Understand the life cycle of your objects JMH tells you that you allocate a gazillion of Objects, now what?
a pre-allocated object out of the object pool ‒ If there are no objects left, we have to resort to allocations • Agent records data from request and response objects ‒ Avoid allocations for example use StringBuilder instead of String concatenation ‒ Currently only Map entry set iterators are allocated (to capture headers and request parameters) • Put recorded transaction into queue ‒ This is a low latency queue, optimized for ITC (LMAX-Exchange/disruptor) ‒ If full, discard transaction • Reporter thread takes transaction out of the queue and batches the data 3 1 4 2
or after timeout, serialize transactions* ‒ Serialization with DSL JSON (https://github.com/ngs-doo/dsl-json) ‒ Zero garbage, no intermediate string representation ‒ Serializes directly into OutputStream of the HTTP request body ‒ Custom garbage free serializer for ISO timestamps ‒ JSON is GZiped • Reset the Transaction object and put it in back to object pool ‒ Transaction is fully mutable ‒ Resets all referenced objects ‒ Immutable Objects can't be reset and create garbage ‒ Favor long timestamp over immutable Instant ‒ Avoid java.util.UUID ‒ Favor primitive types over boxed (int vs Integer) 5 6 *subject to change, we are working on a more efficient streaming-like protocol
errors in (micro-) service architectures ‒ Correlates the interaction of the services by passing correlation IDs • Better integration of APM/logging/metrics • Support for more frameworks and application servers ‒ Spring Web Reactive ‒ Tell us what you want support for: participate in the survey