cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Gentry <>
Subject Re: Memory Management using Tomcat
Date Thu, 17 Sep 2009 13:18:37 GMT
Hi Joe,

The fact that you are seeing a spike with 50-100 concurrent users
doesn't surprise me.  After your sessions timeout, the memory usage
goes back down.  This seems expected to me.

As for my session-based filter, I'm pretty much using what Cayenne
provides.  In my web.xml file for the servlet engine (Tomcat in your
case), I have:

        <filter-name>Cayenne Filter</filter-name>
        <filter-name>Cayenne Filter</filter-name>

To get your context after that:

    private ObjectContext objectContext = BaseContext.getThreadObjectContext();

I think the filter actually creates a DataContext, so you could do a cast there.

On Wed, Sep 16, 2009 at 6:07 PM, Joe Baldwin <> wrote:
> Michael,
> Thank you for your patience on this.  This is the worst problem I have
> encountered and I believe that it is probably something I have misunderstood
> (and failed to implement).
>> FWIW, I just did a little monitoring with JConsole with my current
>> development setup: Eclipse, Jetty, Cayenne 3.0M6, Tapesty 5.1, MySQL.
> Yes I am able to monitor with JConsole on my development machine (but not
> yet on the webhost).  With shared cache ON, and testing with 50-100
> concurrent users, it starts out at about 10-15 MB and then spikes to
> 70-100MB.  Most of the time after the Tomcat idle period (i.e. 15 min) it GC
> down to about 20MB-15MB.
>> This new application I'm working on sounds similar to yours.  Fairly
>> lightweight.  After everything loaded in, I was using 20-21 MB of
>> memory and it stayed steady, even after doing about 100 queries in
>> Cayenne (I tend to pull back 1-7 records per set-of-queries, but
>> closer to 2-3 on average).
> The app sounds similar, but my JConsole reports a huge spike which is only
> released after the idle period. (This is with the Cache set to ON.)
>>  I'm using session-based data contexts and
>> on-demand data contexts.  The memory footprint was fine and I'm not
>> caching (I go get fresh data every query).  I'm not sure why you are
>> seeing the anomaly you are seeing unless you just need a bit more RAM
>> for Tomcat to be stable.
> Mike Kienenberger recommended that I handle this via a filter.  I must admit
> that I am still not totally comfortable with BaseContext and could have made
> a mistake.  I did not want to go in this direction until I am sure that I
> have the blue-print for the correct solution.
> So how do I implement you session-based data context configuration.  (Please
> send explicit code as it appears that I am just using the default
> BaseContext.)
> Thanks,
> Joe

View raw message