This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

application running slowly

 
l suresh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
my application is running slowly if i keep the server for a long time and
if i restart the server then it is running fast.i checked
DatabaseConnection is closed or not and also removed synchronized blocks.
still it is running slowly.

Please sort it out.

Thanks in Advance,
L Suresh
 
Rajah Nagur
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More details please.
What kind of application, what kind of server?
What do you mean by "slow" and "running fast"?
Why do you suspect Database and sync blocks?

Definitely with above details ..you will surely get some help
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you check memory consumption over time?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also removed synchronized blocks.


Randomly trying various tricks is not the way to fix a slow application - you may have set up some ghastly hard to find bug. Synchronization is not likely to be the problem anyway.

As Ilja suggests, gradually slowing down sounds like a build up of memory consumption. Use your operating system monitoring tools and consider profiling your application with something the JAmon open source toolkit.
Bill
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<<Randomly trying various tricks is not the way to fix a slow application>>
Well said. Synchronization is not a performance issue. Either you need it or you don't. You can't just expect to randomly rip out synchronization to make things faster, and not destroy the integrity of your program. That is like randomly deleting rows from a database to make it faster.

Where I work they are having performance problems in an application. I can't even begin to tell you how much code they have 'tuned' while having no real metrics to say if that code had performance problems. And still no-one is focusing on gathering the metrics that would tell them what to tune. The flailing and flopping will probably continue until they either randomly fix the problem or randomly make the program completely unusable. The race is on. Sometimes it sucks to be me (I'll look on the bright side - Sometimes it doesn't suck to be me).
[ August 26, 2006: Message edited by: steve souza ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so the flailing and flopping will probably continue for a while

Hee hee
Back when I was working on big group projects my office mate called this the "witless thrashing" mode of operation. It consumes lots of billable hours but..........
Bill
 
l suresh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
using tomcat5.5.30 as server and the application is on jsp and servlets.
application runs fast when i start the server in the morning.
latter on the application runs slowly.

memory consumption in taskmanager is fine.is there any other way to check memory consumption.


i tried clearing cache using these 2 options.

1)
response.setHeader("Cache-Control","no-Cache");
response.setHeader("pragma","no-Cache");

2)
set Catalina-opts=%catalina-opts%-Xmx128-DSun.io.useCannonCaches=false

but the application still runs slow.
help me out.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by l suresh:
memory consumption in taskmanager is fine.is there any other way to check memory consumption.


The taskmanager can't tell you whether the heap is full.

That Tomcat version is running on Java 5, right? Then you can use jconsole.exe to monitor memory usage: http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html


i tried clearing cache using these 2 options.

1)
response.setHeader("Cache-Control","no-Cache");
response.setHeader("pragma","no-Cache");


That will tell the *client* to not cache the page. If it has an effect at all, than only that the server load gets higher, because it gets more requests.


2)
set Catalina-opts=%catalina-opts%-Xmx128-DSun.io.useCannonCaches=false


What does this do? I've never seen it before, and even Google doesn't seem to find anything enlightening about it...
[ August 28, 2006: Message edited by: Ilja Preuss ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
set Catalina-opts=%catalina-opts%-Xmx128-DSun.io.useCannonCaches=false

This sounds like more thrashing to me. Have you instrumented the application with JAMon or something similar yet?

Personally I use the built in Tomcat manager interface to check the JVM's free, total and max memory settings plus the number of Threads in operation as a quick check on what the JVM thinks is going on.
Bill
 
l suresh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Ilja,



That Tomcat version is running on Java 5, right? Then you can use jconsole.exe to monitor memory usage: http://java.sun.com/j2se/1.5.0/docs/guide/management/jconsole.html

i tried with the way you told by using jconsole.
but i am unable to find the solution.
please help me by putting some extra interest.

thanks in advance,
l suresh
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by l suresh:

i tried with the way you told by using jconsole.
but i am unable to find the solution.
please help me by putting some extra interest.


You need to provide much more information for me to be able to continue to help: what *exactly* did you try, what did you expect to happen, what happened instead, what are your current doubts, etc. pp.
 
l suresh
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

1)i assigned all the created objects as null.
2)in the application every method has finnaly block which has all kind of objects that we used are closed.
3)i increased heap size in tomcat.
4)as you said i used jconsole for monitoring memory utilisation.

the application is expected to run speedly . but it is running slowly at one time and running speedly at another time .

Please sort it out.

Thanks in advance,
l suresh
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please sort it out.

At this point I really should quote you an hourly rate but that would be silly. Why are you so sure that it is the Java end of this app that is responsible for the occasional slowdowns?

How about the database operations - what is going on in the rest of the network, etc etc?? Runs fast in the morning and then slows down could simply be due to database/network load increasing as the day goes by.

If this was my problem I would have already put JAmon monitors around the database calls to collect detailed information about where the time is spent.

Bill
[ August 30, 2006: Message edited by: William Brogden ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by l suresh:
1)i assigned all the created objects as null.


That's not possible - you don't assign null to objects, but to references. And most often you don't have to do that. And even if you do it, it doesn't mean that the object isn't still referenced from somewhere else.

Something that is often overlooked is that inner classes reference their outer instance, and therefore can prevent it from being garbage collected.


4)as you said i used jconsole for monitoring memory utilisation.


And what did you find out???


the application is expected to run speedly . but it is running slowly at one time and running speedly at another time .


How high is the cpu utilization when it is running slowly?
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, the point is simple here. We have no way to help you without you helping yourself a little bit. You need to find out a little more info about what the bottleneck could be. "My application is getting slower throughout the day" could be do to an infinite ammount of reasons.

You need to start measuring performance and look at the numbers and see where they lead you. There are many tools out there that help in doing this. See them at http://www.javaperformancetuning.com

You can use the jamon jdbc proxy driver to record performance of all of your sql and jdbc method calls without you changing one line of code. Just change your driver to use jamon (which in turn connects to the real driver). If you have another tool that is ok too, but simply asking us over and over what to do without providing any more information won't get you anywhere.

Here is how you use the jamon proxy driver. jamon proxy driver instructions
 
Dan Bizman
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by l suresh:
Hi ,

1)i assigned all the created objects as null.
2)in the application every method has finnaly block which has all kind of objects that we used are closed.
3)i increased heap size in tomcat.
4)as you said i used jconsole for monitoring memory utilisation.

the application is expected to run speedly . but it is running slowly at one time and running speedly at another time .

Please sort it out.

Thanks in advance,
l suresh


I could be wrong but it sounds like you think #4 (using jconsole) was supposed to make the app. run faster. That's not what jconsole does. Rather, it will print out information on what's "going on" which you then look at and interpret. Once you've interpreted that information, you can use what you've learned to fix the problem in your app.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic