File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes performance slows down with increasing memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "performance slows down with increasing memory?" Watch "performance slows down with increasing memory?" New topic
Author

performance slows down with increasing memory?

binu ks
Greenhorn

Joined: May 23, 2006
Posts: 5
I am working on a performance issue. This is reported in production, so not much debugging is possible. Here application performance degrades over a period of time. This programs runs for 2 hours for processing 10,000 records. The rate of processing is 200 records/minute initially, then it becomes 150 rec/mt, and finally 25 rec/mt after some time. The kind of processing is same for all records. The overall time (2 hrs) is okay at this point, but the concern is on gradual performance degradation.

What I am trying to find out is:

(1) Can this be due to a memory leak? Will the application slow down when the memory increases? (a dump question, but when I tried with a small program that creates lot of data (to the onset of OutofMemoryError), I couldn't verify this fact. Processing time was the same with and without huge data in memory). btw I am using some collections that hold large number of objects (roughly 10,000).

(2) I have seen some code using WeakReference caching. Will that be helpful here? I could verify that this makes the program more memory efficient. (More objects were getting marked for garbage collection when I used WeakReference, verified this using a static counter variable , increment and display this counter in finalize()).

Waiting for your expert opinion, thanks in advance!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
I suggest you monitor the time spent in various parts of the program with something like JAmon (free) or one of the Java profiler products. There is no sense in speculating when you can measure.

It is not clear from your post exactly what kind of processing is going on.
Is your program talking to a database or what?
Bill
binu ks
Greenhorn

Joined: May 23, 2006
Posts: 5
Thanks for the suggestion..

The program makes Database calls (in many places).
Also it runs on JBoss.

Will try JAmon. Will I need to plug-in the profiler to JBoss? If so will that be possible?
binu ks
Greenhorn

Joined: May 23, 2006
Posts: 5
Bill, Pl ignore my previous post(abt JBoss) as I found out later that JMon is used as part of the application
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
When you finally figure out what was causing your performance problem, please follow up with some details - especially if you find a good solution.

Bill
binu ks
Greenhorn

Joined: May 23, 2006
Posts: 5
Sure!
Ravindra Rawat
Ranch Hand

Joined: Dec 09, 2004
Posts: 34
Have you looked into the availability of database connections with time as how many connections are available in pool?

You can also log the amount of free memory available using "freeMemory()" method in Runtime to actually verify if memory is the issue?

Cheers
Ravindra
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 861
The new version of jamon not only allows you to track performance, but the memory your application consumes. You can call the following after processing each row or batch of rows.



http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
Atish Ray
Greenhorn

Joined: Jun 01, 2006
Posts: 3
Turn on the different verbose options (like printgcdetails or printtenuringdistribution) for gc and see how frequently it's doing garbage collection and what the pattern. You might find as time passes the frequency increasing due to memory leaks in your application that can cause tons of objects occupying unnecessary heap space. That'll give you an initial idea.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

Yes memory leaks can cause performance to drop given you have a limited amount of memory. If you want to test this, reduce the amount of memory you give the JVM at runtime, and see how much faster it slows down. If it does not slow down faster (over time) then your problem is not a memory leak.
binu ks
Greenhorn

Joined: May 23, 2006
Posts: 5
This problem is resolved for now. The application was using Toplink for object/database mapping. For a particular business object, Toplink caching was disabled. I changed Toplink setup to enable caching and the application is performing better now. (before the change, # of records processed per minute:250 -30 . After the fix it is 250-150). For now, this is acceptable to the client. If they come back with this issue later I may have to check memory issues.

I guess I will be reopening this post if the issue returns. Thanks all for your suggestions!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: performance slows down with increasing memory?