Re: Memory Management using Tomcat

From: Joe Baldwin (jfbaldwi..arthlink.net)
Date: Thu Sep 17 2009 - 09:42:45 EDT

  • Next message: Jamie: "Relationships Not Propagated"

    Michael,

    I just checked my web.xml and it appears am using the same filter

    <!-- Cayenne -->
      <context-param>
             <param-name>cayenne.configuration.path</param-name>
             <param-value>/WEB-INF/config/cayenne-files</param-value>
      </context-param>
      <filter>
             <filter-name>CayenneFilter</filter-name>
             <filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</
    filter-class>
      </filter>
      <filter-mapping>
             <filter-name>CayenneFilter</filter-name>
             <url-pattern>/*</url-pattern>
      </filter-mapping>

    In the code I am accessing the BaseContext via the following call:
            ObjectContext oc = BaseContext.getThreadObjectContext();

    So, unless I have misread, it appears we are using almost exactly the
    same code.

    Questions:
    1. I am not sure what you mean by "you could do a cast there".
    2. Should I release this BaseContext and create a new one (as has been
    suggested) or should I simple rely on the BaseContext to manage the
    memory?
    3. Is there some way to message the BaseContext to determine if it has
    properly released memory after a session is complete?

    Thanks,
    Joe

    On Sep 17, 2009, at 9:18 AM, Michael Gentry wrote:

    > 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>
    > <filter-name>Cayenne Filter</filter-name>
    > <filter-
    > class>org.apache.cayenne.conf.WebApplicationContextFilter</filter-
    > class>
    > </filter>
    > <filter-mapping>
    > <filter-name>Cayenne Filter</filter-name>
    > <url-pattern>/*</url-pattern>
    > </filter-mapping>
    >
    > 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.
    >



    This archive was generated by hypermail 2.0.0 : Thu Sep 17 2009 - 09:43:25 EDT