Child pages
  • About Aprof

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 37 Next »

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.

Features overview

  • Fast (can 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 detailness)
  • Open Source (help us improve it!)

Known issues

In current version (build 21):

  • Does not work with a code that is compiled by Java 7

Origin and Goals

Java VM has an option -Xaprof printing how many instances of classes were allocated during lifetime of the application and how much memory they occupied in total and per instance. The option has no performance impact due to the fact that counting takes place during garbage collection. The only drawbacks are occasional overflows of counters and the absence of any information on locations where the object allocations take place.

Aprof aims to overcome drawbacks of Java VM option -Xaprof by:

  • collecting information on locations where the object allocations take place. 
  • providing an accurate profiling results.
  • having very low performance impact (to be safely used in production environments).

When to use Aprof

Aprof should be used when the application spends a lot of time in garbage collection. Due to the specifics of Java VM, objects are allocated so fast that CPU profilers are unable to pinpoint the allocation hotspot. The only way is to use memory allocation profilers.

There are many good memory allocation profilers. Unfortunately, in order to find locations where object allocations take place, they do the following:

  • on object allocation, a stack-trace is taken. This takes significant time and generates some garbage.
  • in order to lessen performance impact of taking stack-traces, sampling is used (i.e. not every object allocation is recorded). This leads to inaccurate profiling results.

As a result, memory allocation profilers leave us with both inaccurate profiling results and an impact on the profiled application.

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

 

  • No labels