[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [aspectj-users] Garbage collector behavior
- From: "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx>
- Date: Sun, 30 Oct 2005 09:37:36 -0700
- Delivered-to: firstname.lastname@example.org
- Organization: New Aspects of Software
- Thread-index: AcXbwL4h92KLya11T5KUcw4y+Pg7zQATCsEA
I used a recent AspectJ dev to take more measurements on a development
version of my Glassbox Inspector (with a few more aspects than the alpha
one). It turns out the biggest problem I'm seeing is the overhead per
classloader, since Tomcat is creating one classloader per JSP using about
Here are the stats I'm seeing.
Memory use on startup (Tomcat 5.5 with 3 sample apps autostarted):
Without weaving: 22M
Weaving the inspector into all shared apps: 106M (after forcing GC)
The main memory user is the Spring 1.2.1 Web app (it has loaded over 900
classes). The other app loading over 100 classes is the Axis server Web app
(but less than 200).
At startup the loader for the Spring Web app has 67 type mungers, and over
800 loaded classes in world.delegate.loadedClasses, plus over 900
expendableMap entries (will they ever be evicted)?
It seems surprising that it would take about 80 MB to hold data about 1000
classes: does this really seem right/
I then walked through the ~15 pages of the Spring petclinic app.
Unfortunately, Tomcat loads *each JSP in its own ClassLoader*. So the memory
consumed went up yet again to 154M: about 3M per page (per class loader).
I am able to re-enable one helpful optimization that Matthew Webster and I
were testing: using reflective type delegates for bootstrap classes instead
of creating BCEL objects.
This takes my memory use down to 76M on startup (after forcing GC).
However, after hitting all the pages, it's again up to 127M (after forcing
GC). So the ~3M/classloader overhead is still about the same.
If I deploy a null aop.xml file in shared/lib (i.e., I define no aspects in
it), then the memory use on startup is 62M even with this optimization.
That's still 40M of overhead. After I visit most of the Petclinic pages the
memory use is up to 75M. So it appears there's about 1M of overhead per
classloader and my aspects are consuming 2M of overhead per classloader...
I think that weaving into Web apps is going to require some kind of scheme
to share information that mirrors classloading hierarchies.
I'd like to find more information about where the initial 45M of overhead
(200% of the total memory used without weaving) is going. I'd also like to
understand how the 3M/classloader overhead breaks down. My next step is to
use a memory profiler to get more data on each.
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Mathieu LEMAIRE
Sent: Friday, October 28, 2005 7:09 AM
Subject: Re: [aspectj-users] Garbage collector behavior
I had to bench clearly memory consumptions and cpu usage overheads in
those configs (aspect scalability, LTW / compile time W, no aspect at
all) and here is what i got :
weaving glM (KB) tgPk (KB) ccM (KB) tgM
(KB) glT (ms) gcT (ms)
bench1 CT few aspects 70,085.41 97,510.18 26.71 65,470.21
CT many aspects 70,064.73 97,497.00 26.11 65,470.54
LT few aspects
117,904.67 112,381.06 161.26 112,381.06 16,512.71
70,067.72 97,515.85 25.37 65,469.83 15,737.30
LT many aspects
119,323.28 109,141.54 107.46 109,141.54 18,595.90
bench2 CT few aspects 77,874.13 72,646.21 31.59 72,646.21
CT many aspects 75,584.27 70,877.49 29.85 70,877.49
LT few aspects
103,814.15 103,671.09 267.99 93,940.62 38,536.98
77,716.08 72,481.75 29.85 72,481.75 40,638.22
LT many aspects
102,670.77 104,942.94 238.74 95,081.41 43,023.24
quick legend :
* *glM : *globalMemoryConsumed
* *tgPk : *peakMemoryConsumed
* *ccM : *codeCacheMemoryConsumed
* *tgM : *tenuredGenMemoryConsumed
* *glT : *globalTime
* *gcT : *gcTime
Those marks have been done using hotspot 1.5 and new JMX features..
Well those results should not stand as direct proofs but maybe just
hints on the LTW consumption.
My aspects are really simple : for profiling I do not use any runtime
check nor advanced aspectj features such as thisJointPoint** and when I
say *many* aspects, i just mean 15, compared to *few* (1) :)
The important thing is that the overhead resides in the tenured gen
pool, quite an old space.. that means that aspectj ltw still holds hard
references somewhere and forcing collections should not help with any
thing... Other interesting stuff is code cache consumption ; well I do
not know much about that, but ltw needs much more than simply
duplicating class defs.
The very good news is that compile time weaving do not introduce any
distorsion ; that is great for my profiling !!
hope it helps.
aspectj-users mailing list