JVM 内存管理机制构成 及物理内存和虚拟内存
Better performance in production servers is possible with proper configuration of JVM parameters, particularily those related to memory usage and garbage collection.
It is good practice with server-side Java applications like Resin to set the minimum -Xms and maximum -Xmx heap sizes to the same value.
For efficient garbage collection, the -Xmn value should be lower than the -Xmx value.
If you monitor your java process with an OS tool like top or taskmanager, you may see the amount of memory you use exceed the amount you have specified for -Xmx. -Xmx limits the java heap size, java will allocate memory for other things, including a stack for each thread. It is not unusual for the total memory consumption of the VM to exceed the value of -Xmx. (thanks to Rob Lockstone for his comments) There are essentially two GC threads running. One is a very lightweight thread which does "little" collections primarily on the Eden (a.k.a. Young) generation of the heap. The other is the Full GC thread which traverses the entire heap when there is not enough memory left to allocate space for objects which get promoted from the Eden to the older generation(s). If there is a memory leak or inadequate heap allocated, eventually the older generation will start to run out of room causing the Full GC thread to run (nearly) continuously. Since this process "stops the world", Resin won't be able to respond to requests and they'll start to back up. The amount allocated for the Eden generation is the value specified with -Xmn. The amount allocated for the older generation is the value of -Xmx minus the -Xmn. Generally, you don't want the Eden to be too big or it will take too long for the GC to look through it for space that can be reclaimed. See also: Each thread in the VM get's a stack. The stack size will limit the number of threads that you can have, too big of a stack size and you will run out of memory as each thread is allocated more memory than it needs. The Resin startup scripts (httpd.exe on Windows, wrapper.pl on Unix) will set the stack size to 2048k, unless it is specified explicity. 2048k is an appropriate value for most situations.
-Xss determines the size of the stack: -Xss1024k. If the stack space is too small, eventually you will see an exception .
Some people have reported that it is necessary to change stack size settings at the OS level for Linux. A call to ulimit may be necessary, and is usually done with a command in /etc/profile:
JDK 5 includes a number of tools that are useful for monitoring the JVM. Documentation for these tools is available from the Sun website. For JDK's prior to 5, Sun provides the jvmstat tools. The most useful tool is jconsole. Details on using jconsole are provided in the Administration section of the Resin documentation. jps and jstack are also useful, providing a quick command line method for obtaining stack traces of all current threads. Details on obtaining and interpreting stack traces is in the Troubleshooting section of the Resin documentation.
程序员浪费生命的几种方式
1、开发一个质量和性能很差的系统
2、花费大量人力财力开发一个一次性的项目
3、开发一个很漂亮花哨的无人用的系统
4、全新开发一个原有遗留的系统
5、开发一个项目范围不确定的系统
6、开发一个没有系统角色或涉众的系统
7、开发一个使用环境不确定的项目
SQL执行计划 Execution plan with Derby
CALL SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(1);
select * from EDW_BPM_OBJECT;
call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATISTICS(0);
VALUES SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();