• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java performance  RSS feed

 
Abhi Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Thanks for reading my post.
Are there any tools by which we can measure (test ) the performance of a method or a class. :roll:
What are the best tuning statergies used in Java/J2EE.

It will be helpful if you guys can help me with few url's
Regards
 
arulk pillai
Author
Ranch Hand
Posts: 3404
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do a number of things based on your budget, how comprehensively you want to analyse etc. Here is an extract:

Profiling can be used to identify any performance issues or memory leaks. Profiling can identify what lines of code the program is spending the most time in? What call or invocation paths are used to reach at these lines? What kinds of objects are sitting in the heap? Where is the memory leak? Etc.

Option 1:There are many tools available for the optimization of Java code like JProfiler, Borland OptimizeIt, Wiley's Introscope, etc. These tools are very powerful and easy to use. They also produce various reports with graphs.

Optimizeit� Request Analyzer provides advanced profiling techniques that allow developers to analyze the performance behavior of code across J2EE application tiers. Developers can efficiently prioritize the performance of Web requests, JDBC, JMS, JNDI, JSP, RMI, and EJB so that trouble spots can be proactively isolated earlier in the development lifecycle.

Thread Debugger tools can be used to identify threading issues like thread starvation and contention issues that can lead to system crash.

Code coverage tools can assist developers with identifying and removing any dead code from the applications.

Option 2: Hprof which comes with JDK for free. Simple tool.

Java �Xprof myClass

java -Xrunhprof:[help]|[<option>=<value>]
java -Xrunhprof:cpu=samples, depth=6, heap=sites

Use operating system process monitors like NT/XP Task Manager on PCs and commands like ps, iostat, netstat, vmstat, uptime, nfsstat etc on UNIX machines.

Option 3: Write your own wrapper MemoryLogger and/or PerformanceLogger utility classes with the help of totalMemory() and freeMemory() methods in the Java Runtime class for memory usage and System.currentTimeMillis() method for performance. You can place these MemoryLogger and PerformanceLogger calls strategically in your code. Even better approach than utility classes is using Aspect Oriented Programming (AOP � e.g. Spring AOP) or dynamic proxies for pre and post memory and/or performance recording where you have the control of activating memory/performance measurement only when needed.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!