CPU usage of my Java application

Dear everyone,

I have a Java application that runs as a server - serving data to client apps.

So, the server app is designed to run infinitely, unless stopped.

The problem is that nearly after two weeks of operation, the server app starts

consuming large amounts of CPU progressively.

In windows task manager my server shows has these data:

ServerApp1032(PID)50(CPU)83:13:49(CPU Time)30,448(Mem usage)

The alarming part is that the value for CPU time keeps ticking up - 1 for

every second. This up ticking starts only after nearly two weeks of operation,

though.

Could you please help me in understanding the problem? Why is the CPU Time

up ticking? What is the significance of CPU Time, and what are the likely

culprits?

Thanks a lot!

George

[854 byte] By [0xdeaddeaf] at [2007-9-30 2:48:57]
# 1
i dont know that it really signifies much as I dont know how well windows task manager can be trusted. Without seeing the code its hard to tell.Any routines in your program which are times based? What are your jvm memory settings?
_dnoyeB at 2007-6-29 10:41:18 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 2
From what I know the CPU time would increase when ever the CPU is used. CPU time is the amount of time the CPU is use by the thread or that process.
chris_foo at 2007-6-29 10:41:18 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 3

You didn't say what eventually happens to your app - does it die, or becomes too slow, or what? That is, is there any real reason to worry? Part of the reason to ask about this is that Microsoft's software in infamous for its glitches. So who knows, maybe it's some problem with the Task Manager, rather than your software - say some counter in TM just overflows in 2 weeks :-)

If you really observe some problem with your app, you probably need some ligtweight monitoring tool for Java to get a better idea of what's happening. A tool that at least shows you the heap total/used size, the number of threads, the GC pauses length etc. could help. Actually, one very likely problem that you might have is that your app has reached some threshold wrt. memory usage, which forced GC to happen more frequently, hence the increased CPU usage. I know one tool, http://research.sun.com/projects/jfluid, which has these monitors - but the downside is that it needs its own customized JVM, which may be not the best thing to use for a production application. No doubt similar tools should exist that use a standard JVM. And at least for the heap consumption, you can easily get some data by just running your JVM with the -verbose:gc option.

count_mdm at 2007-6-29 10:41:18 > top of Java-index,Archived Forums,Debugging Tools and Techniques...
# 4

I wouldnot trust microsoft windows for such kind of monitoring. What I would suggest is to perform some kind of load test on your application before deployinf it commercially. You could also use something like OptimizeIt in order to optimize your performance and find the loop holes and memory leaks. Its very hard to such a monitoring on a live system since there are too many variables involved. Performance testing would involve you in complete knowledge of as what you are trying to test at a particular point in time. Is the impact of the DB connection or the no. of sockets opened? so you might have to write some testcases dealing with performance and start from there.

yrhduahcmarruhk at 2007-6-29 10:41:18 > top of Java-index,Archived Forums,Debugging Tools and Techniques...