• Post Reply Bookmark Topic Watch Topic
  • New Topic

CPU Usage  RSS feed

 
John Ryan
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This may sound like a silly question for a somewhat experienced programmer to be asking but I need some pointers/help with diagnosing excess CPU usage by my application.
What Im looking for are some introductory articles/tips that explain what are the common reasons for high CPU usage in a Java application. We have a number of calls to a database plus calls to a number of third party libraries so its possible the problem could lie in any of these.
Im ashamed to say but I dont fully understand what are the factors which lead to overuse of the CPU. I understand that a large number of uninterupted instructions could contribute to this but Im somewhat vague on other issues such as the effects of IO and memory allocation issues.
All feedback appreciated.
John
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing to be ashamed about. I've been on a performance kick lately and I've dug up some valuable resources. Sun has a couple of on-line books. Advanced Programming for Java 2 has an introductory chapter on techniques and Java Platform Performance goes in-depth. Of course, if you are using a database, there's other performance considerations. Java Performance Tuning is a clearinghouse for tips on Java performance, including application servers and database servers, but be aware that some of the tips for earlier JVM's are not relevant for the newer Hotspot VM's.
If you want a good performance book, I keep going back to the
Java 2 Performance and Idiom Guide. Their #1 recommendation: A fast computer with a lot of memory. There is no substitute for power.
It's also a good idea to move your DB server and app server to different computers so they aren't competing for the CPU and other resources.
Good luck!
[ May 11, 2004: Message edited by: Joe Ess ]
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest using a profiling tool like mentioned in this thread: Tool For Code Optimization
If the database is already on a different machine, calling it shouldn't lead to much cpu-load.
If the profiler tells you, that the problem is in the 3-rd-party tools, you avoid reading the books (but they might be interesting allthough)
[ May 11, 2004: Message edited by: Stefan Wagner ]
 
John Ryan
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cheers guys................
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!