Child pages
  • About Aprof

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Aprof is a Java memory allocation profiler with very low performance impact on the profiled application that can be used (and is used) on highly-loaded server-side applications in production environment. It acts as an agent which transforms class bytecode by inserting counter increments wherever memory allocation is done and tracks a precise size of allocated objects in bytes. It also keeps limited information about allocation context to aid to finding the memory allocation bottlenecks. See short Tutorial for basic usage and examples. 

Using aprof

 

Download the latest version of aprof distribution, unzip, copy "aprof.jar" to your application's directory and run application with an additional JVM argument:

No Format
java -javaagent:aprof.jar <your-application-options>

Run it and watch for "aprof.txt" file that will be updated every minute with memory allocation details reports for your application for the last minute (with totals in separate section at the end) in a human-readable form. There will be somewhat slower start-up time due to transformation and a lot of extra memory allocations by aprof itself, so wait a couple of minutes until your application and aprof warm up (aprof allocates all the memory it needs to operate during start-up and warm-up), start your application's workload, wait some more time until your application warms up under load, and use reports in "aprof.txt" to find memory allocation bottlenecks in your application under load.

To get help on configuration parameters, run 

No Format
java -jar aprof.jar

Do not rename agent file "aprof.jar", because it is configured by its name in manifest and will not work when renamed. 

Features overview

  • Fast (can be used and is designed to be used in production) 
  • Provides detailed information (can be used to identify problematic pieces of code)
  • Configurable level of detail (as a compromise between speed and detailnesslevel of detail)
  • Open Source (help us improve it!see, learn, improve)

Known issues

In current version (build 28):

  • Does not take into account the fact, that some memory allocation are removed by modern HotSpot VM, however it does not prevents HotSpot from allocating objects on stack.
  • Does not work on some releases of 1.6 (1.6.0_21 crashes with FATAL ERROR), but otherwise works in Java 1.5 to Java 1.7.
  • Does not fully analyze inheritance hierarhy hierarchy when tracking configured method invocations. It does not intercept locations of invocations of tracked methods that are performed via a sub-type that inherits the tracked method, It does misleadingly report invocation locations of a non-tracked method that happen to go via super-type that declares a tracked method for some other implementation of this type where this method is tracked. 

...

Aprof gets accurate profiling results and finds locations of object allocations at the same time being garbage-free and having very low performance impact. Learn how to use it.

Contents

Page Tree
root@none