You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Daniel L. Gross" <dg...@atlc-inc.com> on 2006/11/21 20:59:30 UTC

Memory Usage

I really could use some help here.  Has anyone used tomcat 5.5 with the 
J-Connector?  I made a simple servlet that just opens a connection to my 
MYSQL database and then closes it and does nothing else.  When I look at 
the windows task manager, the memory usage of Tomcat jumps each time I 
run the servlet.  The memory is never recovered.  Does anyone have a 
similar problem?  And is there a solution?  I am running some production 
stuff that uses similar code, and when the Tomcat memory usage gets to 
1GB, Tomcat stops working and handling requests.

Thanks so much, Dan


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by Gaurav Kushwaha <ga...@gmail.com>.
I would say you are barking on a wrong tree in suspecting the garbage
collector to be the culprit. Garbage collection not running in time(or in
proper intervals) can cause the applicatin to slow down or have spikes in
the performance but it will not cause the applicaiton to stop.

Lets try to list out the possible scenarios:

   1. You have a memory leak and thus you are losing memory every time
   you invoke the servlet. In this case, you should end up with an
   OutOfMemoryException.
   2. Your servlets are not going back to the servlet pool and hence
   tomcat has starting to queue up the further requests. In this case, it will
   appear as if Tomcat has stopped responding. Check the state of your server
   queue to see if you have requests waiting there.
   3. You have a deadlock in your code. Take the thread dump and see if
   there is one.

As for garbage collector, you can use System.gc() but even that doesn't
ensure that the garbage collector will be invoked. Better option usually is
to tune the GC parameters but all that helps is with the performance. If you
have a memory leak, even invoking GC won't help.

On 11/22/06, Daniel L. Gross <dg...@atlc-inc.com> wrote:
>
> Is there a way to force Tomcat 5.5  to run a garbage collection?
>
> Thanks, Dan
>
>
> Caldarale, Charles R wrote:
>
> >>From: Daniel L. Gross [mailto:dgross@atlc-inc.com]
> >>Subject: Re: Memory Usage
> >>
> >>I have run the lamda probe on the software, but it
> >>didn't show anything useful.
> >>
> >>
> >
> >It's not a profiler, and was never intended to be.
> >
> >
> >
> >>Where do I turn on the -verbose:gc?  In the tomcat start-up script?
> >>
> >>
> >
> >It's a standard java launcher option.  If you're running from a script,
> >try setting it in JAVA_OPTS before kicking off the script.
> >
> > - Chuck
> >
> >
> >THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> >MATERIAL and is thus for use only by the intended recipient. If you
> >received this in error, please contact the sender and delete the e-mail
> >and its attachments from all computers.
> >
> >---------------------------------------------------------------------
> >To start a new topic, e-mail: users@tomcat.apache.org
> >To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> >For additional commands, e-mail: users-help@tomcat.apache.org
> >
> >
> >
> >
> >
>
>
Gaurav Singh Kushwaha
http://www.chakpak.com
Ph: +91-9880101496
Bangalore, India.

Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
Is there a way to force Tomcat 5.5  to run a garbage collection?

Thanks, Dan


Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>I have run the lamda probe on the software, but it 
>>didn't show anything useful.
>>    
>>
>
>It's not a profiler, and was never intended to be.
>
>  
>
>>Where do I turn on the -verbose:gc?  In the tomcat start-up script?
>>    
>>
>
>It's a standard java launcher option.  If you're running from a script,
>try setting it in JAVA_OPTS before kicking off the script.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

Re: Memory Usage

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dan,

Daniel L. Gross wrote:
> It appears to be running garbage collection, but it doesn't recover all
> the memory, so as we make and break connections to the database, the
> memory usage just keeps piling up.  We never had this problem with the
> old connector running under Tomcat 4.

So, what changed between TC 4 and TC 5? You mentioned the "old connector"...

Have you tried running your "test app" on TC 4 to see if it behaves
appropriately? Make sure you aren't running different versions of any
libraries (other than the ones shipped with TC). So, for instance, make
sure you are always using the same version of the Connector/J library.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFY3bK9CaO5/Lv0PARApNrAKC20iiaCPDvdFXgOhg9CvI+G/DxZQCfX/VP
R1QUaLWS0gfUY63fM4RSCPk=
=6Xdh
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
It appears to be running garbage collection, but it doesn't recover all 
the memory, so as we make and break connections to the database, the 
memory usage just keeps piling up.  We never had this problem with the 
old connector running under Tomcat 4.

Thanks, Dan


Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>I have run the lamda probe on the software, but it 
>>didn't show anything useful.
>>    
>>
>
>It's not a profiler, and was never intended to be.
>
>  
>
>>Where do I turn on the -verbose:gc?  In the tomcat start-up script?
>>    
>>
>
>It's a standard java launcher option.  If you're running from a script,
>try setting it in JAVA_OPTS before kicking off the script.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

Re: Memory Usage

Posted by Gaurav Kushwaha <ga...@gmail.com>.
See, tomcat doesn't create a thread per request. It uses one from the pool
and after doing its job the thread returns to the pool. What might be
happening in your case is that those threads are not going back to the pool
after processing the request. So you will need to find out where those
threads are getting blocked and then take care of that. Best way to go about
that is to take a thread dump. That will tell you exactly where in your code
your threads are getting blocked and it should be pretty straight forward
after that.
About memory, my best guess is that since the thread is blocked, its still
referencing objects that it shouldn't otherwise, hence jump in memory usage
per request. You fix first problem and the second one should take care of
itself.


On 11/22/06, Daniel L. Gross <dg...@atlc-inc.com> wrote:
>
> I appreciate your help with this problem.  I downloaded JProfiler and
> ran it on tomcat 5.5.20.  The garbage collection is running fine.
> Memory keeps going up when I make and break connections to the
> database.  What appears to be happening is that every time I execute my
> app, when it closes, Tomcat leaves an inactive thread hanging.  I think
> if I could clear up the inactive threads, the garbage collection routine
> would get the memory back.  Is there any way to release inactive threads
> in Tomcat 5.5?
>
> Thanks again so much,
>
> -- Dan.
>
>
Gaurav Singh Kushwaha
http://www.chakpak.com


Ph: +91-9880101496
Bangalore, India.

Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
As an additional note:  I put up a simple test servlet that prints to 
the screen and it does not leave any threads hanging nor does it have a 
memory problem so it is definately something connected to how I use the 
J-Connector or open and close the database.  The problem only occurs 
when I make a connection to the database.  If this helps any.

Thanks again.  I really need to solve this problem because it's a show 
stopper for my application.

-- Dan


Daniel L. Gross wrote:

> I looked at the profiler and it appears that there are many timer 
> threads left hanging.  I have not set up a data source for Tomcat or 
> any connection pooling.  I am opening a connection to the database 
> directly with the following code.  Could this be causing my problem?
>
> thanks again, Dan
>
>  public M5Connection(String DBHost, String DBName, String DBUsername,
>                      String DBPassword) throws SQLException {
>    //setup the DB connectivity paramters
>    DATABASE_HOST = DBHost;
>    DATABASE_NAME = DBName;
>    DATABASE_USERNAME = DBUsername;
>    DATABASE_PASSWORD = DBPassword;
>
>    loadDBDriver(); //load the JDBC driver class into memory at runtime
>    connect(); //connect to the database using the above driver
>
>  } // constructor
>
>  public Connection getConnection() {
>    return conn;
>  }
>
>  //used to load the DB Driver into memory at runtime
>  private void loadDBDriver() {
>    // The newInstance() call is a work around for some
>    // mm.MySQL implementations
>    try {
>      Class.forName("com.mysql.jdbc.Driver").newInstance();
>      System.out.println("Driver instantiated"); //debug
>    }
>    catch (Exception E) {
>      System.err.println("Unable to load driver.");
>      E.printStackTrace();
>    }
>  }
>
>  //connects to a database
>  private void connect() throws SQLException {
>    conn = DriverManager.getConnection("jdbc:mysql://" + DATABASE_HOST 
> + "/" +
>                                       DATABASE_NAME + "?user=" +
>                                       DATABASE_USERNAME + "&password=" +
>                                       DATABASE_PASSWORD);
>    System.out.println("Connection made"); //debug
>
>  }
>
>
> Caldarale, Charles R wrote:
>
>>> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] Subject: Re: 
>>> Memory Usage
>>>
>>> What appears to be happening is that every time I execute my app, 
>>> when it closes, Tomcat leaves an
>>> inactive thread hanging.
>>>   
>>
>>
>> I seriously doubt that Tomcat is doing this - much more likely that your
>> app is causing it, or possibly the DB driver.  Does the app create any
>> auxiliary threads and not have them terminate?  If that's not the case,
>> and threads from Tomcat's pool were not returning to it after processing
>> a request for your app, you'd run out of threads pretty quickly.  What
>> does a thread dump show about where these hanging threads are hanging
>> out?
>>
>> - Chuck
>>
>>
>> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>> MATERIAL and is thus for use only by the intended recipient. If you
>> received this in error, please contact the sender and delete the e-mail
>> and its attachments from all computers.
>>
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>  
>>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by Gaurav Kushwaha <ga...@gmail.com>.
About thread dump:
When you are using Tomcat Manager to dump threads, it might be doing that in
your catalina.out file. So check that file after dumping.

About timer threads:
When you stop Tomcat, it waits for all the non-daemon threads to finish
execution before proceeding with normal shutdown. Since your timer threads
are not daemon threads and those threads don't even die a natural death,
Tomcat can not shut your application down. One option for you is to declare
your timer task to be a Daemon thread but then it will be killed even if it
is in middle of performing the task so its not advisable.



On 11/22/06, Caldarale, Charles R <Ch...@unisys.com> wrote:
>
> > From: Daniel L. Gross [mailto:dgross@atlc-inc.com]
> > Subject: Re: Memory Usage
> >
> > I have tried various times in the tomcat configuration
> > file, but nothing seems to matter.
>
> This isn't a Tomcat configuration value - it's for the specific JDBC
> driver that your app is using.  Might want to check the doc for that to
> see if anything interesting can be found.
>
> - Chuck




Gaurav Singh Kushwaha
http://www.chakpak.com


Ph: +91-9880101496
Bangalore, India.

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Re: Memory Usage
> 
> I have tried various times in the tomcat configuration
> file, but nothing seems to matter.

This isn't a Tomcat configuration value - it's for the specific JDBC
driver that your app is using.  Might want to check the doc for that to
see if anything interesting can be found.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
In MySql the timeout is 10 seconds.  I have tried various times in the 
tomcat configuration file, but nothing seems to matter.

-- Dan


Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>The tomcat start/stop manager has a dump threads option,
>>it doesn't seem to do anything when I click it.
>>    
>>
>
>Start Tomcat using catalina run, and then do whatever your OS needs to
>send an interrupt (ctrl-break on Windows).
>
>  
>
>>Here's some additional information from the profiler.
>>It's a stack trace of the Timer-0 thread:
>>
>>java.sql.DriverManager.getConnection(java.lang.String)
>>M5Classes.M5Connection.connect()
>>    
>>
>
>This shows it's trying to connect to the server; what's the DB
>connection timeout value?  Infinite, by any chance?
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Re: Memory Usage
> 
> The tomcat start/stop manager has a dump threads option,
> it doesn't seem to do anything when I click it.

Start Tomcat using catalina run, and then do whatever your OS needs to
send an interrupt (ctrl-break on Windows).

> Here's some additional information from the profiler.
> It's a stack trace of the Timer-0 thread:
> 
> java.sql.DriverManager.getConnection(java.lang.String)
> M5Classes.M5Connection.connect()

This shows it's trying to connect to the server; what's the DB
connection timeout value?  Infinite, by any chance?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
How to I dump the threads, there doesn't seem to be an option in the 
Profiler.  The tomcat start/stop manager has a dump threads option, it 
doesn't seem to do anything when I click it.  Here's some additional 
information from the profiler.  It's a stack trace of the Timer-0 thread:

java.sql.DriverManager.getConnection(java.lang.String)
M5Classes.M5Connection.connect()
M5Classes.M5Connection 
<init>(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
_jprofiler_annotation_class.URL:/Tracks/servlet/Router()
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()

I think we have found the problem. Every time I make a connection, it 
leaves one of these threads hanging.  Now whats the solution?  That's 
the $50. question.

Thanks, Dan


Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>I looked at the profiler and it appears that there are many timer 
>>threads left hanging.
>>    
>>
>
>What do you mean by "timer threads"?  What does a thread dump show about
>them?
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Re: Memory Usage
> 
> I looked at the profiler and it appears that there are many timer 
> threads left hanging.

What do you mean by "timer threads"?  What does a thread dump show about
them?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
I looked at the profiler and it appears that there are many timer 
threads left hanging.  I have not set up a data source for Tomcat or any 
connection pooling.  I am opening a connection to the database directly 
with the following code.  Could this be causing my problem?

thanks again, Dan

  public M5Connection(String DBHost, String DBName, String DBUsername,
                      String DBPassword) throws SQLException {
    //setup the DB connectivity paramters
    DATABASE_HOST = DBHost;
    DATABASE_NAME = DBName;
    DATABASE_USERNAME = DBUsername;
    DATABASE_PASSWORD = DBPassword;

    loadDBDriver(); //load the JDBC driver class into memory at runtime
    connect(); //connect to the database using the above driver

  } // constructor

  public Connection getConnection() {
    return conn;
  }

  //used to load the DB Driver into memory at runtime
  private void loadDBDriver() {
    // The newInstance() call is a work around for some
    // mm.MySQL implementations
    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      System.out.println("Driver instantiated"); //debug
    }
    catch (Exception E) {
      System.err.println("Unable to load driver.");
      E.printStackTrace();
    }
  }

  //connects to a database
  private void connect() throws SQLException {
    conn = DriverManager.getConnection("jdbc:mysql://" + DATABASE_HOST + 
"/" +
                                       DATABASE_NAME + "?user=" +
                                       DATABASE_USERNAME + "&password=" +
                                       DATABASE_PASSWORD);
    System.out.println("Connection made"); //debug

  }
 

Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>What appears to be happening is that every time I 
>>execute my app, when it closes, Tomcat leaves an
>>inactive thread hanging.
>>    
>>
>
>I seriously doubt that Tomcat is doing this - much more likely that your
>app is causing it, or possibly the DB driver.  Does the app create any
>auxiliary threads and not have them terminate?  If that's not the case,
>and threads from Tomcat's pool were not returning to it after processing
>a request for your app, you'd run out of threads pretty quickly.  What
>does a thread dump show about where these hanging threads are hanging
>out?
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Re: Memory Usage
> 
> What appears to be happening is that every time I 
> execute my app, when it closes, Tomcat leaves an
> inactive thread hanging.

I seriously doubt that Tomcat is doing this - much more likely that your
app is causing it, or possibly the DB driver.  Does the app create any
auxiliary threads and not have them terminate?  If that's not the case,
and threads from Tomcat's pool were not returning to it after processing
a request for your app, you'd run out of threads pretty quickly.  What
does a thread dump show about where these hanging threads are hanging
out?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
I appreciate your help with this problem.  I downloaded JProfiler and 
ran it on tomcat 5.5.20.  The garbage collection is running fine.  
Memory keeps going up when I make and break connections to the 
database.  What appears to be happening is that every time I execute my 
app, when it closes, Tomcat leaves an inactive thread hanging.  I think 
if I could clear up the inactive threads, the garbage collection routine 
would get the memory back.  Is there any way to release inactive threads 
in Tomcat 5.5?

Thanks again so much,

-- Dan.


Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Re: Memory Usage
>>
>>I have run the lamda probe on the software, but it 
>>didn't show anything useful.
>>    
>>
>
>It's not a profiler, and was never intended to be.
>
>  
>
>>Where do I turn on the -verbose:gc?  In the tomcat start-up script?
>>    
>>
>
>It's a standard java launcher option.  If you're running from a script,
>try setting it in JAVA_OPTS before kicking off the script.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Re: Memory Usage
> 
> I have run the lamda probe on the software, but it 
> didn't show anything useful.

It's not a profiler, and was never intended to be.

> Where do I turn on the -verbose:gc?  In the tomcat start-up script?

It's a standard java launcher option.  If you're running from a script,
try setting it in JAVA_OPTS before kicking off the script.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Memory Usage

Posted by "Daniel L. Gross" <dg...@atlc-inc.com>.
Thanks for your quick response.  I thought about a memory leak which is 
why ran a simple servlet that just opened and closed a connection to the 
database.  And even a simple servlet had the problem.
Another point is that our sofware has been running for a few years on 
tomcat 4 with the mm-mysql older JDBC connector with no memory 
problems.  In fact, one of our servers is still running tomcat 4 and it 
hasn't been rebooted or tomcat restarted for almost a year.  If we had 
any serious memory leaks in our code, it would have shown up on that 
server.  I have run the lamda probe on the software, but it didn't show 
anything useful.

It is possible in Tomcat 5.5 that garbage collection is never called.  I 
think this is most likely the problem from what you said.
Where do I turn on the -verbose:gc?  In the tomcat start-up script?

Thanks again,  Dan




Caldarale, Charles R wrote:

>>From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
>>Subject: Memory Usage
>>
>>I made a simple servlet that just opens a connection to my 
>>MYSQL database and then closes it and does nothing else.  
>>When I look at the windows task manager, the memory usage
>>of Tomcat jumps each time I run the servlet.  The memory
>>is never recovered.
>>    
>>
>
>The Task Manager is not a substitute for a profiler, which is what you
>really need to look at.  Search the archives or Google to find one to
>your liking.  Also try turning on -verbose:gc, just to see if a garbage
>collection ever occurs; until a GC does happen, unused object space
>won't be made available for reuse.  Also, the JVM almost never gives
>memory back to the OS, so what you're seeing is not surprising.
>
>As far as your production problem, you most likely have a memory leak in
>your application(s).  A profiler should help uncover that.
>
> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>  
>

RE: Memory Usage

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Daniel L. Gross [mailto:dgross@atlc-inc.com] 
> Subject: Memory Usage
> 
> I made a simple servlet that just opens a connection to my 
> MYSQL database and then closes it and does nothing else.  
> When I look at the windows task manager, the memory usage
> of Tomcat jumps each time I run the servlet.  The memory
> is never recovered.

The Task Manager is not a substitute for a profiler, which is what you
really need to look at.  Search the archives or Google to find one to
your liking.  Also try turning on -verbose:gc, just to see if a garbage
collection ever occurs; until a GC does happen, unused object space
won't be made available for reuse.  Also, the JVM almost never gives
memory back to the OS, so what you're seeing is not surprising.

As far as your production problem, you most likely have a memory leak in
your application(s).  A profiler should help uncover that.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org