tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bently Drake <>
Subject Re: Database connections grow after redeploy
Date Fri, 14 Mar 2008 14:03:13 GMT
Memory leaks and deadlocks and CPU hogs! Java application developers often face these runtime
problems. They can be particularly daunting in a complex application with multiple threads
running through hundreds of thousands of lines of code -- an application you can't ship because
it grows in memory, becomes inactive, or gobbles up more CPU cycles than it should.
Here are some tools that can help you finding out your application performance. You can monitor
thread usages, memory leaks, instance count etc; also in case of web application you can find
out the number of sessions, number of request per second, average response time, database
connection time, error count etc.
1 JProfiler: JProfiler is an award-winning all-in-one Java profiler. JProfiler's intuitive
GUI helps you find performance bottlenecks, pin down memory leaks and resolve threading issues.
You can use it to monitor a standalone java application or a web application.
·          Live profiling of a local session
·          Live profiling of a remote session
·          Offline profiling
·          Snapshot comparisons
·          Memory profiling
·          Heap walker
·          CPU profiling
·          Thread profiling



2. ManageEngine® Applications Manager 8
Applications Manager provides in depth monitoring of web applications, be it a CRM application,
banking / finance application or any business critical application. Applications Manager can
also help monitor the underlying infrastructure which may consist of application servers,
databases, systems, mail servers and other Java/J2EE Applications. 
Through the application monitoring feature you can ensure the health and availability of your
application servers through Microsoft .NET Monitoring, Oracle Application Server Monitoring,
JBoss Monitoring, Tomcat Monitoring, WebLogic Monitoring, and WebSphere Monitoring. Out-of-the-box
support for databases through Oracle Monitoring, SQL Server Monitoring, MySQL Monitoring,
DB2 Monitoring is also present.
Applications Manager helps ensure higher uptime by detecting and diagnosing problems of application
servers and their services faster


3. JMeter
Apache JMeter is a 100% pure Java desktop application designed to load test functional behavior
and measure performance. It was originally designed for testing Web Applications but has since
expanded to other test functions.
Apache JMeter may be used to test performance both on static and dynamic resources (files,
Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can
be used to simulate a heavy load on a server, network or object to test its strength or to
analyze overall performance under different load types. You can use it to make a graphical
analysis of performance or to test your server/script/object behavior under heavy concurrent
Apache JMeter features include: 
·         Can load and performance test HTTP and FTP servers as well as arbitrary database
queries (via JDBC) 
·         Complete portability and 100% Java purity . 
·         Full Swing and lightweight component support (precompiled JAR uses packages javax.swing.*
·         Full multithreading framework allows concurrent sampling by many threads and simultaneous
sampling of different functions by seperate thread groups. 
·         Careful GUI design allows faster operation and more precise timings. 
·         Caching and offline analysis/replaying of test results. 
·         Highly Extensible: 
o        Pluggable Samplers allow unlimited testing capabilities. 
o        Several load statistics may be choosen with pluggable timers . 
o        Data analysis and visualization plugins allow great extendibility as well as personalization.

o        Functions can be used to provide dynamic input to a test or provide data manipulation.

o        Scriptable Samplers (BeanShell is fully supported; and there is a sampler which supports
BSF-compatible languages) 

4 Lambda Probe (formerly known as Tomcat Probe)
Lambda Probe (formerly Tomcat Probe) is a self sufficient web application, which helps to
visualize various parameters of Apache Tomcat instance in real time. Lambda Probe is designed
to work specifically with Tomcat so it is able to access far more information that is normally
available to JMX agents.
JVM memory usage monitor 
JBoss compatibility 
Display of deployed applications, their status, session count, session object count, context
object count, datasource usage etc 
Ability to view deployed JSP files 
Display of list of sessions for a particular application 
Graphical display of datasource details including maximum number of connections, number of
busy connections and configuration details 
Display of system information including, memory usage bar and OS details

Ability to show information about log files and download selected files 
Ability to tail log files in real time from a browser. 
Ability to interrupt execution of "hang" requests without server restart 
Support for DBCP, C3P0 and Oracle datasources 
Support for Tomcat 5.0.x and 5.5.x 
Support for Java 1.4 and Java 1.5 

And here are some more that you can explore
Tools for tracking down memory leaks.
XPCOM Memory Leak tools (this document also has information on Mozilla's other memory leak
tools). See also a tutorial on using these tools and the refcount balancer. 
Rational Purify®. (Commercial) 
GlowCode. (Commercial) 
"Electric Fence ... uses the virtual memory hardware of your system to detect when software
overruns the boundaries of a malloc() buffer. It will also detect any accesses of memory that
has been released by free(). Because it uses the VM hardware for detection, Electric Fence
stops your program on the first instruction that causes a bounds violation." 
Specifically, it works by placing each heap allocation on its own VM page. Since the dynamic
footprint of the browser is pretty large, this may make it tough to use "in real life". 
Leaky. This is a home-grown tool that Kipp put together: 
"Its a tool called leaky. What it does it help you track down memory leaks and some kinds
of memory corruption. It also has entry pointers for logging addref/release calls. The key
thing that leaky does is this: it logs all calls to malloc/free/realloc/new/delete into a
log file. The logging data includes information about size and address, as well as the *call
stack of the operation*. The leaky program then can translate the call stack data from addresses
into symbols and then dump the data out." * 
refcount balancer. This is another home-grown tool that does finer-grained instrumentation
and allows you to focus on specific objects rather than entire runs. 
Insure++®. (Commercial) Evaluation copy is free. Linux version. 
debauch Dead? 
Geodesic Systems' GreatCircle Dead? Scott Furman has done some preliminary work to get this
product working with Mozilla. 
Julian Seward writes of Valgrind, an open-source memory debugger and profiler for Linux/x86:
`Snapshots 20020511 and later of the tool are able to run Mozilla correctly on both Red Hat
6.2 and 7.2. It will also do detailed low-level I1/D1/L2 cache profiling, so you can see which
bits of Mozilla create cache misses. You'll need the patch from bug 124335 if working with
versions prior to 1.0RC2. 
The following tools are used to measure product performance.
Rational PurifyPlus. (Commercial) Used to be called Rational Quantify. A Perl script for munging Quantify 6.0 output into hyperlinked HTML to share
with your friends. Run Quantify, save your results as text, and then let this thing rip. 
Quantifying Mozilla on Solaris. Instructions on how to make Quantify play nicely with Mozilla
on Solaris. 
For performance work on Mac, you can use either the Metrowerks Profiler (on subsets of the
codebase), or Apple's Instrumentation SDK. For details, see the page on Mac performance. 
hiprof. A hierarchical instruction profiler for Digital Unix. There is an online tutorial,
courtesy Jim Nance ( 
"I like it because it does not require you to recompile the program, because it give accurate
times for callers, and because it comes with DU so that everyone developing there should already
have it." * 
jprof. Sampling profiling tool by Jim Nance that runs on RedHat 6.1, 6.2. 
MOZ_TIMELINE Timing instrumentation. Extremely useful for app startup measurements. 
eazel profilers. Two profiling tools from Eazel/, runs on Linux. 
JS Runtime Profiler. Profile JavaScript usage, dumps output to a file. 
Sysinternals utilities. Win9x/Me/NT/2K utilites for monitoring system usage. CPU/Mon, Diskmon,
Filemon, Regmon, etc. 
gprof. Part of the GNU Binutils. Back in May 1999 there were rumors that gprof had trouble
with dynamically linked and loaded objects (like Mozilla). Currently (March 2006) gprof is
still being developed, so hopefully that's no longer true (assuming it ever was). The link
to the gprof manual above is years out of date but, at the time of writing, it's the latest
version of the manual on To get an up to date version of the manual, get the gprof
source and run |. configure; make html| in the gprof source directory. 

----- Original Message ----
From: David Cassidy <>
To: Tomcat Users List <>
Sent: Friday, March 14, 2008 7:13:17 PM
Subject: Re: Database connections grow after redeploy

try netbeans
its free and the profiler will watch all your objects being created.
it will also work with snapshots...

On Thu, 2008-03-13 at 20:56 +0200, Juha Laiho wrote:
> Scott McClanahan wrote:
> > > On Thu, 2008-03-13 at 12:02 -0400, Christopher Schultz wrote:
> > > Caldarale, Charles R wrote:
> > |> From: Scott McClanahan []
> > |> Subject: Re: Database connections grow after redeploy
> > | As far as the continuing data base connections, I can only speculate
> > | that the prior instances of the webapp are still active, thereby
> > | preventing cleanup of their resources.
> > > I agree.. Scott: are you able to run your application through a tool that
> > > allows you to observe the heap and object graphs?
> > > More likely is that one or more application-level objects has retained a
> > > reference to a specific Connection object, which, of course, retains
> > > references back to the connection pool that created it. I would check
> > > any ServletContextListener classes you have, and then a generic search
> > > for putting things into the ServletContext, since that is one of the
> > > only places that applications typically store long-lived objects.
> > Do you have any suggestions for a profiling tool like you described?
> > Preferably open source.  Thanks.
> Don't know about open source products, but I can vouch for YourKit Java
> Profiler. As far as I know, the main difference between YourKit and other
> profilers is that YourKit allows you to work through snapshots, whereas
> other profilers inject their probes into Java object creation methods.
> This means that more or less the only moment when YourKit has an effect
> on the performance of your application is when you take a memory snapshot.
> The other profilers I've seen attempt to trace each object allocation and
> deallocation in real time, which can be rather CPU consuming (especially
> if you're tracing a problem you cannot replicate in test environments).
> With YourKit, you take snapshots of the Java VM memory of your application,
> and compare them "off-line" (i.e. without needing any connection to the
> live application).

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

Never miss a thing.  Make Yahoo your home page.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message