1 / 45

Java Performance on z/OS: A Report From the Front Lines

Java Performance on z/OS: A Report From the Front Lines. Craig Hodgins. Paper 5047 Session 332. CMG2005. Agenda. A Brief History of Java Why Java Matters on the Mainframe An Overview of Java for Mainframers Review of Two STROBE Measurements JVM CPU JITC CPU JAVAJIT CPU

paloma
Télécharger la présentation

Java Performance on z/OS: A Report From the Front Lines

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java Performance on z/OS: A Report From the Front Lines Craig Hodgins Paper 5047 Session 332 CMG2005

  2. Agenda A Brief History of Java Why Java Matters on the Mainframe An Overview of Java for Mainframers Review of Two STROBE Measurements JVM CPU JITC CPU JAVAJIT CPU ZIP files Java CPU Overhead (logging, security) Java Methods Summary CMG2005

  3. A Brief History of Java 10 years old Developed at Sun Microsystems as an embedded language for household appliances Redesigned to work with cable TV Language of choice for the Internet Still used as an embedded language CMG2005

  4. Why Java Matters on the Mainframe IBM developed WebSphere Application Server Enables organizations to utilize Java applications under z/OS Java is frequently the biggest consumer of CPU in a WAS environment Java is replacing COBOL as the language of choice But Java consumes 5 to 10 times more CPU than COBOL does for the same function CMG2005

  5. What is Java? Java is not… … a 1960’s reference to coffee … an island in the Pacific CMG2005

  6. What is Java? An object-oriented language Objects (bank account) Methods (withdrawal, deposit, open, close) CMG2005

  7. Components of Java Applets are Java programs running in a web browser Servlets are Java programs running in a web server JavaServer Pages (JSPs) display data to the user Enterprise Java Beans (EJBs) are server-side components that contain business logic Most of these components can execute under WAS on z/OS CMG2005

  8. Java / COBOL Java method contains multiple statements and is like a COBOL CSECT Java class contains multiple methods and is like a COBOL load module A Java package is an organizational tool similar to a high level qualifier or a Windows directory A Java CLASSPATH is similar to a library in z/OS or a PATH in Windows CMG2005

  9. The Java Call Stack As the Java application executes, memory is allocated in the Java Call Stack Frames are pushed and popped on and off the stack as the methods are invoked The state of the Java Call Stack reflects the chain of methods from the initial method called to the current method that is executing CMG2005

  10. Java Call Stack com.compuware.PayRoll.main(void)  com.compuware.Payroll.CalculateSalary(…)  com.compuware.Payroll.ComputeOverTime(…)  java.lang.String.CharAt(…)  java.lang.String.toLowerCase(…) Java Application • The Call Stack is an area of memory that maintains the order in which Java methods are executed • When a method is invoked, a “Stack Frame” is “pushed” to the top stack of the stack • When the method is completed, it is “popped” off the stack Call Stack toLowerCase CharAt ComputeOverTime CalculateSalary main top  bottom 

  11. WAS Architecture

  12. Session duration 15 minutes CPS 40.57% Wait 59.43% CPU 5 min CMG2005

  13. Java 41.55% Libjvm 29.70% CMG2005

  14. JVM CPU Usage JVM is the environmental code Java engine that manages the components Usually consumes around 25-35% of the CPU If JVM CPU seems high: upgrade to a newer release apply latest maintenance CMG2005

  15. Libjitc 4.13% CMG2005

  16. JITC CPU Usage Java is interpreted by default IBM introduced a Just-in-Time Compiler that will compile methods on the fly MMI (Mixed Mode Interpreter) parm sets threshold that must be reached before compilation Forces distribution of compilation overhead… CMG2005

  17. JITC CPU Usage … when the JVM initiates, thousands of methods are executed Significant overhead all at once as methods are compiled Possible that it may take longer to initiate the JVM than run the application CMG2005

  18. JITC CPU Usage JIT on, MMI on (default) JVM will start relatively quickly (interpreted) and runtime performance will improve over time (JITC) JIT off, MMI off JVM will start quickly, but runtime execution will be slow (interpreted) JIT on, MMI off (forces compilation only) JVM will start slowly but runtime will be optimized CMG2005

  19. JAVAJIT CPU Usage JAVAJIT is the CPU consumed by the total compiled methods in the measurement CMG2005

  20. Libjitc 26.51% JAVAJIT 16.17% CMG2005

  21. JAVAJIT 50.01% Libjitc 4.13% CMG2005

  22. Libzip 5.54% CMG2005

  23. ZIP Files ZIP files are used to combine multiple class files into one file to reduce I/O overhead, load time, or file transfer time 5.54% may be acceptable (must determine your own benchmarks) Recommendation is to use uncompressed ZIP or JAR files to reduce compression overhead CMG2005

  24. Class Loading JVM searches the directories in the order they are listed in the CLASSPATH environment variable Class loader has two modes Application mode: search first within the application directory and then the IBM directory J2EE mode: search first in the IBM directory and then the application directory CMG2005

  25. Class Loading Paths should be reordered so that the most used libraries are found first Package the classes in the order in which they are loaded by the application Do not add unnecessary class files to avoid large files and extra memory usage CMG2005

  26. JAVA CPU Overhead Computers make it easier to do a lot of things, but most of the things they make it easier to do don’t need to be done. Andy Rooney CMG2005

  27. JAVA CPU Overhead Hierarchical method invocation requires extra processing for each method call to determine the target (build the call stack) Keep current on JVM releases and maintenance levels Security checks consume CPU (eg 7.6%) Tuning security is a trade-off between performance and integrity CMG2005

  28. JAVA CPU Overhead Logging always degrades performance Documented techniques to have logging turned on in test but turned off in production Different levels of logging can be customized CMG2005

  29. Rtrim 3.41% CMG2005

  30. RTRIM Method Inhouse routine to strip off rightmost bytes of data Developer thought it may be possible to rewrite the application such that RTRIM was not required CMG2005

  31. The Cost of the RTRIM Method Measurement was for 15 minutes, CPU time was 5 minutes: WAS CPU per hour = 5 minutes x 4 = 20 minutes WAS CPU per year = .3 X 8760 = 2628 hours RTRIM CPU per year = 3.41% of 2628 = 89 hours Total dollar cost of RTRIM per year = $550.00 X 89 = $48,950.00 May run in other applications and multiple WAS CMG2005

  32. MicroValidator 1.65% validateField 0.59% CMG2005

  33. Validate Method Some kind of validation process Can it be done on another platform? Some less expensive way of validating? CMG2005

  34. String 3.32% StringBuffer 1.10% CMG2005

  35. Text Processing (Strings) Strings are immutable Cannot be modified A new StringBuffer object will be created under the covers A new String object is returned via the toString method Beware of text processing in loops CMG2005

  36. Text Processing (Strings) Several methods generate new instances of objects: concat replace substring trim CMG2005

  37. Text Processing (Strings) StringBuffers are modifiable Use them to avoid creating temporary String objects Possible alternative solution: use character arrays instead of strings CMG2005

  38. toUpperCase toLowerCase CMG2005

  39. Text Processing (Strings) Why are we using these methods? Can they be done on another platform? Is there a better way? CMG2005

  40. Text Processing (Strings) When parsing a string, pass the length as a parm Otherwise Java must make many calls to the String.length method Use char arrays rather than using String.charAt CMG2005

  41. Summary JVM – keep up with maintenance JITC – optimize MMI parm ZIP – use judiciously Methods – Always question things: Ask “Why?” Ask “How?” Ask “Is there a better way?” CMG2005

  42. Summary The opposite of a correct statement is a false statement. The opposite of a profound truth may well be another profound truth. Niels Bohr, Quantum Physicist Common sense is not very common – Latin proverb CMG2005

  43. Further Reading Diagnostics Guide JDK 1.3.1 (SC34-6200-02) Java Performance Tuning, Jack Shirazi www.javaperformancetuning.com Other books, other websites CMG2005

  44. Final Thought No matter what kind of system we have or what the application is, nothing in computer work seems to go as quickly as we think it should. The faster computers move, the more they try our patience. We get a more powerful machine and it still doesn’t process fast enough to satisfy us. Simple as a task might seem to finish, it inevitably takes longer than predicted. There’s always one more thing to get right, to tweak, to test again. Zen Computer CMG2005

  45. Thank you Craig.hodgins@compuware.com

More Related