The Java virtual machine uses its heap storage for dynamic allocation memory. In addition, each thread requires reserved memory for the stack used to pass method parameters. You can tune the memory used by setting these properties of the EAServer Manager Server Properties dialog box, or by using jagtool. To set these properties, use the syntax documented in their reference pages in Appendix B, “Repository Properties Reference,” in the EAServer System Administration Guide:
com.sybase.jaguar.server.jvm.maxHeapSize specifies the maximum heap size. The JVM reserves this much memory at start-up. The memory used for object allocation cannot exceed this amount. If the heap size is exceeded, you see request failures accompanied by java.lang.OutOfMemoryError errors in the error log.
com.sybase.jaguar.server.jvm.minHeapSize specifies the minimum, or initial heap size. While the maximum size is reserved at start-up, only the minimum size is monitored and allocated from by the JVM. Set this value to the same size as the maximum heap size. The maximum heap size is reserved at server start-up regardless of the minimum size, and using equal sizes avoids the CPU overhead of dynamically growing the heap.
com.sybase.jaguar.server.jvm.options configures
additional start-up options for the Java VM. The -XssStackSize
parameter
can be tuned to configure the stack size for Java threads. StackSize is
the amount of virtual memory reserved for the stack of each Java
thread.
Optionally set com.sybase.jaguar.server.jvm.verboseGC to true to enable trace output from the Java garbage collector. The trace output describes how often the garbage collector runs, how long it takes, and what objects are deallocated. For information on the encoding of the output, see the documentation for the JDK version that you are running the server with.
The optimum heap size depends on your application and machine configuration. To tune the value, first verify that you have removed any memory leaks from your own code. Then test under expected peak load conditions to determine the minimum size that allows the application to run without errors. If the heap size is too large, it uses memory that could otherwise be used for the call stack required to run each thread. Large heap sizes can also incur a larger delay when the Java garbage collector runs. Never set the heap size larger than the machine’s physical memory; if you do, the system will swap memory to disk. Set the minimum and maximum sizes to equal values, using the syntax described in the reference pages for these properties in the EAServer System Administration Guide, Appendix B, “Repository Properties Reference.”
Set the Java thread stack size to the smallest value that still allows the application to run. Usual values are 256K or 512K for the applications used for internal stress testing at Sybase. Most applications should never require more than 1Mb. The stack must be large enough to accommodate parameters passed in component dispatcher and intercomponent calls. However, if the value is too high, it limits the maximum number of threads that can be spawned. To run N threads, there must at least N x StackSize of free memory available.
Copyright © 2005. Sybase Inc. All rights reserved. |