THE WELCH COMPANY
440 Davis Court #1602
San Francisco, CA 94111-2496
415 781 5700
rod@welchco.com
S U M M A R Y
DIARY: February 25, 2012 09:28 PM Saturday;
Rod Welch
SDS jave called Morris about slow solve with JVM settings.
1...Summary/Objective
2...Memory Management JVM Restore Memory Manage Heap Stack
3...JVM Memory Restore Manage Heap Stack Improve Processing Speed
4...SDS Improve Speed Java Virtual Memory Restore Manage Heap Stack
5...Speed SDS Improve Java Virtual Memory Restore Manage Heap Stack
....Performance
....1...Server Caching
....1...JVM Tuning
....5...Resin startup with heap memory options
...10...Garbage Collection...
...14...Stack size
...20...Monitoring JVM
..............
Click here to comment!
CONTACTS
SUBJECTS
SDS Performance Improve Speed JVM Java Virtual Memory Restore Garbag
2303 -
2303 - ..
2304 - Summary/Objective
2305 -
230501 - Follow up ref SDS 4 6A5M, ref SDS 3 0W4R.
230502 -
230503 -
230504 -
230505 - [...below on 120225 2128 submitted research to Morris on
230506 - applying JVM to improve performance of SDS java.
230507 - ref SDS 0 UN4V
230508 -
230509 -
230511 - ..
2306 -
2307 -
2308 - Progress
2309 -
230901 - Memory Management JVM Restore Memory Manage Heap Stack
230902 - JVM Memory Restore Manage Heap Stack Improve Processing Speed
230903 - SDS Improve Speed Java Virtual Memory Restore Manage Heap Stack
230904 - Speed SDS Improve Java Virtual Memory Restore Manage Heap Stack
230905 -
230906 -
230907 - Called Morris this evening to discuss SDS java slow performance and
230908 - how high performance computer can help?
230910 - ..
230911 - We have previously discussed experience on 120203, showing SDS java
230912 - takes 45 seconds to construct a new Subject Index account, which takes
230913 - original SDS 3 seconds to generate. ref SDS 3 0W4R
230915 - ..
230916 - On 120205 ordered "high performance" computer, ref SDS 4 6A5M,
230918 - ..
230919 - Asked about interpreting published review of Intel i7-3960X with
230920 - DX78SI motherboard and X79 Express chipset, reported on 120205 0907.
230921 - ref SDS 4 PZ45
230923 - ..
230924 - Explained recent findings testing new computer with i7-3960X processor
230925 - but configured with other motherboard and chipset, reported on 120214
230926 - 1433. ref SDS 5 HA6N
230928 - ..
230929 - This evening, Morris suggested adding Windows configuration commands
230930 - to the Java call for launching SDS can improve SDS processing speed.
230931 - Morris cited java virtual machine (JVM) commands that increase
230932 - processing speed and so reduce time allocated by Windows for managing
230933 - memory and "garbage cleanup."
230934 -
230935 - [...below on 120225 2128 submitted research to Morris on
230936 - applying JVM to improve performance of SDS java.
230937 - ref SDS 0 UN4V
230939 - ..
230940 - During the call, we found Windows 7 properties that launch SDS, which
230941 - is currently predicated on netbeans...
230942 -
230943 - C:\sd\60\NetBeansProjects\jedit\dist\jedit.jar messages c:\sd\33\04702
230945 - ..
230946 - Morris seemed to indicate this command string is not easily modified
230947 - to apply changes that improve java performance.
230949 - ..
230950 - Previously discussed compiling Medit java code and related libraries
230951 - into a single program exe file to simplify deployment, reported on
230952 - 081104 0700. ref SDS 1 YD5I This avoids calling SDS through netbeans
230953 - platform, and seesm to be supported by research on 100831, indicating
230954 - code for java applications is typically compiled into a Windows exe
230955 - program file, similar to original SDS called simply by e.exe.
230956 - ref SDS 2 UP4J
230958 - ..
230959 - Morris indicated an understanding that conflicts between SDS java code
230960 - and java program code that resides independently on the computer
230961 - cannot be avoided by compiling everything into a platform independent
230962 - exe program file. Decided not to take time this evening on this
230963 - compiler issue.
230964 -
230965 - [On 120228 1023 letter to Gary asks for comment on
230966 - compiling SDS java into exe file. ref SDS 6 NQ4U
230968 - ..
230969 - Instead, discussed applying JVM commands to improve performance.
230971 - ..
230972 - Morris explained Internet search criteria that found...
230973 -
230974 -
230975 - Performance
230976 -
230977 - http://www.caucho.com/resin-3.0/performance/index.xtp
230978 -
230979 - 1. JMS - Java Message Service
230980 -
230981 - http://www.caucho.com/resin-3.0/jms/index.xtp
230983 - ..
230984 - 2. Serving Caching................. ref SDS 0 8Y5J
230986 - ..
230987 - 3. JVM Tuning...................... ref SDS 0 4M8F
230988 -
230989 -
230990 - ***********************************************************
230991 - ***********************************************************
230992 -
230994 - ..
230995 - 1. Server Caching
230996 -
230997 - http://www.caucho.com/resin-3.0/performance/caching.xtp
230999 - ..
231000 - Server caching can speed dynamic pages to near-static speeds.
231001 - Many pages created by database queries only change every 15
231002 - minutes or so, e.g. CNN or Slashdot. Resin can cache the
231003 - results and serve them like static pages. Resin's caching will
231004 - work for any servlet, including JSP and XTP pages. It depends
231005 - only on the headers the servlet returns in the response.
231007 - ..
231008 - 2. By default, pages are not cached. To cache, a page must set a
231009 - HTTP caching header.
231011 - ..
231012 - 3. Resin's caching operates like a proxy cache. It's controlled
231013 - by the same HTTP headers as any proxy cache. Every user shares
231014 - the same cached page.
231015 -
231016 - ***** There is a lot of guidance at this address ****
231017 -
231018 -
231019 - ********************************************************
231021 - ..
231022 - 1. JVM Tuning
231023 -
231024 - http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp
231026 - ..
231027 - 2. Better performance in production servers is possible with
231028 - proper configuration of JVM parameters, particularily those
231029 - related to memory usage and garbage collection.
231030 -
231031 - [...below on 120225 2128 submitted research to Morris on
231032 - applying JVM to improve performance of SDS java.
231033 - ref SDS 0 UN4V
231035 - ..
231036 - 3. Heap Size...
231037 -
231038 - The allocation of memory for the JVM is specified using -X
231039 - options when starting Resin (the exact options may depend upon
231040 - the JVM that you are using, the examples here are for the Sun
231041 - JVM).
231043 - ..
231044 - 4. JVM Options Passed to Resin
231045 -
231046 - -Xms............................. initial java heap size
231047 - -Xmax............................ maximum java heap size
231048 - -Xmn............................. size of heap for young generation
231050 - ..
231051 - 5. Resin startup with heap memory options
231052 -
231053 - unix> bin/httpd.sh -Xmn100M -Xms500M -Xmx500M
231054 - win> bin/httpd.exe -Xmn100M -Xms500M -Xmx500M
231055 - install win service> bin/httpd.exe -Xmn100M -Xms500M -Xmx500M -install
231057 - ..
231058 - 6. It is good practice with server-side Java applications like
231059 - Resin to set the minimum -Xms and maximum -Xmx heap sizes to
231060 - the same value.
231062 - ..
231063 - 7. For efficient garbage collection [...see below, ref SDS 0
231064 - J56G...], the -Xmn value should be lower than the -Xmx value.
231066 - ..
231067 - 8. Heap size does not determine the amount of memory your process
231068 - uses
231070 - ..
231071 - 9. If you monitor your java process with an OS tool like top or
231072 - taskmanager, you may see the amount of memory you use exceed
231073 - the amount you have specified for -Xmx. -Xmx limits the java
231074 - heap size, java will allocate memory for other things,
231075 - including a stack for each thread. It is not unusual for the
231076 - total memory consumption of the VM to exceed the value of
231077 - -Xmx.
231079 - ..
231080 - 10. Garbage Collection...
231081 -
231082 - http://www.caucho.com/resin-3.0/performance/jvm-tuning.xtp#garbage-collection
231083 -
231084 - (thanks to Rob Lockstone for his comments)
231086 - ..
231087 - There are essentially two GC threads running. One is a very
231088 - lightweight thread which does "little" collections primarily
231089 - on the Eden (a.k.a. Young) generation of the heap. The other
231090 - is the Full GC thread which traverses the entire heap when
231091 - there is not enough memory left to allocate space for objects
231092 - which get promoted from the Eden to the older generation(s).
231094 - ..
231095 - 11. If there is a memory leak or inadequate heap allocated,
231096 - eventually the older generation will start to run out of room
231097 - causing the Full GC thread to run (nearly) continuously. Since
231098 - this process "stops the world", Resin won't be able to respond
231099 - to requests and they'll start to back up.
231101 - ..
231102 - 12. The amount allocated for the Eden generation is the value
231103 - specified with -Xmn. The amount allocated for the older
231104 - generation is the value of -Xmx minus the -Xmn. Generally, you
231105 - don't want the Eden to be too big or it will take too long for
231106 - the GC to look through it for space that can be reclaimed.
231108 - ..
231109 - 13. See also:
231110 -
231111 - 1. Troubleshooting Technique: Garbage Collector
231112 -
231113 - http://www.caucho.com/resin-3.0/troubleshoot/technique.xtp#garbage-collector
231114 -
231115 - 2. Sun documenation on garbage collection
231116 -
231117 - http://java.sun.com/docs/hotspot/gc1.4.2/
231119 - ..
231120 - 14. Stack size
231121 -
231122 - Each thread in the VM get's a stack. The stack size will limit
231123 - the number of threads that you can have, too big of a stack
231124 - size and you will run out of memory as each thread is
231125 - allocated more memory than it needs.
231127 - ..
231128 - 15. The Resin startup scripts (httpd.exe on Windows, wrapper.pl on
231129 - Unix) will set the stack size to 2048k, unless it is specified
231130 - explicity. 2048k is an appropriate value for most situations.
231131 -
231132 - JVM option passed to Resin
231133 -
231134 - -Xss....................... stack size for each thread
231135 -
231136 - 16. -Xss determines the size of the stack: -Xss1024k.
231138 - ..
231139 - 17. If the stack space is too small, eventually you will see an
231140 - exception class java.lang.StackOverflowError .
231142 - ..
231143 - 18. Some people have reported that it is necessary to change stack
231144 - size settings at the OS level for Linux. A call to ulimit may
231145 - be necessary, and is usually done with a command in
231146 - /etc/profile:
231148 - ..
231149 - 19. Limit thread stack size on Linux
231150 -
231151 - ulimit -s 2048
231153 - ..
231154 - 20. Monitoring JVM
231155 -
231156 - JDK 5 includes a number of tools that are useful for
231157 - monitoring the JVM. Documentation for these tools is available
231158 - from the Sun website. For JDK's prior to 5, Sun provides the
231159 - jvmstat tools.
231161 - ..
231162 - 21. The most useful tool is jconsole. Details on using jconsole
231163 - are provided in the Administration section of the Resin
231164 - documentation.
231165 -
231166 - jconsole
231167 -
231168 - win> ./httpd.exe -Dcom.sun.management.jmxremote
231169 - unix> bin/httpd.sh -Dcom.sun.management.jmxremote
231170 -
231171 - .. in another shell window ...
231172 -
231173 - win> jconsole.exe
231174 - unix> jconsole
231176 - ..
231177 - Choose Resin's JVM from the "Local" list.
231178 -
231179 - 22. jps and jstack are also useful, providing a quick command line
231180 - method for obtaining stack traces of all current threads.
231181 - Details on obtaining and interpreting stack traces is in the
231182 - Troubleshooting section of the Resin documentation.
231183 -
231184 - jps and jstack
231185 -
231186 - # jps
231187 - 12903 Jps
231188 - 20087 Resin
231189 - # jstack 20087
231190 - Attaching to process ID 20087, please wait...
231191 - Debugger attached successfully.
231192 - Client compiler detected.
231193 - JVM version is 1.5.0-beta2-b51
231194 - Thread 12691: (state = BLOCKED)
231195 - - java.lang.Object.wait(long) (Compiled frame; information may be imprecise)
231196 - - com.caucho.util.ThreadPool.runTasks() @bci=111, line=474 (Compiled frame)
231197 - - com.caucho.util.ThreadPool.run() @bci=85, line=423 (Interpreted frame)
231198 - - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)
231200 - ..
231201 - Thread 12689: (state = BLOCKED)
231202 - - java.lang.Object.wait(long) (Compiled frame; information may be imprecise)
231203 - - com.caucho.util.ThreadPool.runTasks() @bci=111, line=474 (Compiled frame)
231204 - - com.caucho.util.ThreadPool.run() @bci=85, line=423 (Interpreted frame)
231205 - - java.lang.Thread.run() @bci=11, line=595 (Interpreted frame)
231206 -
231207 - ...
231209 - ..
231210 - 23. Copyright © 1998-2006 Caucho Technology, Inc. All rights
231211 - reserved. Resin® is a registered trademark, and HardCoretm and
231212 - Quercustm are trademarks of Caucho Technology, Inc.
231213 -
231214 -
231216 - ..
2313 -
2314 -
2315 - 1920
2316 -
231601 - Sent letter to Morris with link this research on trying to implement
231602 - on Monday.
231603 -
231604 - 1. Subject: JVM Parameters Improve Performance SDS-java
231605 - Date: Sun, 26 Feb 2012 18:40:35 -0800
231612 - ..
231613 - 2. This was very good news that settings to improve memory
231614 - management might yield better performance for SDS-java. Here
231615 - is research we found last night (see line 221000. ref SDS 0
231616 - 4M8F
231618 - ..
231619 - 3. Hopefully, we can try this on Monday, and make progress on
231620 - remote access with tigervcn.
231621 -
231627 -
231628 -
231629 -
231630 -
231631 -
231632 -
231633 -
231634 -
231635 -
2317 -