Note 723909 - Java VM Settings for J2EE 640

7
30.11.2010 Page 1 of 7 SAP Note 723909 - Java VM settings for J2EE 6.40/7.0 Note Language: English Version: 34 Validity: Valid Since 14.06.2010 Summary Symptom This note describes recommended JVM settings for standard SAP java applications, for example EP, XI, CRM, etc., running on SAP J2EE Engine 6.40/7.0. For 7.1 please refer to Note 1248926. Other terms tuning memory j2ee portal OutOfMemoryError OOM out of memory Out of swap space Reason and Prerequisites j2ee Solution The information in this note is relevant if you don't use the configuration template (see note 739788) or if you want to manually configure your java stack installation. Configuration templates are only applicable to newly installed systems based on the J2EE Engine 6.40 SP7 (corresponds to NetWeaver'04 SP Stack 04) or above. For all other systems you have to configure JVM settings as described below. Before starting manual configuration please read the following notes: 716604 for the Sun JDK (Windows, Linux, Solaris) 716926 for the HP JDK (HP-UX) 716927 for the IBM JDK (AIX) 1234382 for the IBM JDK IT4J (IBM i, iSeries, OS/400) 717376 for the IBM JDK Classic (IBM i, iSeries, OS/400) 1319038 for the IBM JDK J9 (Linux for zSeries) 746299 for the IBM JDK Sovereign (Linux for zSeries) 810008 for the IBM JDK (Linux on POWER) 861215 for the IBM JDK (Linux on AMD64/EM64T) NB: Note 709140 is obsolete! Note 722520 was removed from the list above because the Java stack is not supported on Tru64 (see note 872554). Since some of the above notes only take into account the "default" SAP J2EE developer installation some parameters must be set differently for an production systems. If there are conflicts between parameters recommended in the platform specific notes and the general recommendations below the platform specific recommendations have precedence. The java parameters have to be set via ConfigTool, see note 710146. Remark: for adjusting of the SDM Heap see note 879377. o 1. Java version

Transcript of Note 723909 - Java VM Settings for J2EE 640

30.11.2010 Page 1 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

Note Language: English Version: 34 Validity: Valid Since 14.06.2010

Summary

SymptomThis note describes recommended JVM settings for standard SAP javaapplications, for example EP, XI, CRM, etc., running on SAP J2EE Engine6.40/7.0. For 7.1 please refer to Note 1248926.

Other termstuning memory j2ee portalOutOfMemoryError OOM out of memoryOut of swap space

Reason and Prerequisitesj2ee

SolutionThe information in this note is relevant if you don't use the configurationtemplate (see note 739788) or if you want to manually configure your javastack installation.Configuration templates are only applicable to newly installed systemsbased on the J2EE Engine 6.40 SP7 (corresponds to NetWeaver'04 SP Stack 04)or above.For all other systems you have to configure JVM settings as describedbelow.

Before starting manual configuration please read the following notes:

716604 for the Sun JDK (Windows, Linux, Solaris)716926 for the HP JDK (HP-UX)716927 for the IBM JDK (AIX)1234382 for the IBM JDK IT4J (IBM i, iSeries, OS/400)717376 for the IBM JDK Classic (IBM i, iSeries, OS/400)1319038 for the IBM JDK J9 (Linux for zSeries)746299 for the IBM JDK Sovereign (Linux for zSeries)810008 for the IBM JDK (Linux on POWER)861215 for the IBM JDK (Linux on AMD64/EM64T)

NB: Note 709140 is obsolete! Note 722520 was removed from the list above because the Java stack is not supported on Tru64 (see note 872554).

Since some of the above notes only take into account the "default" SAP J2EEdeveloper installation some parameters must be set differently for anproduction systems.

If there are conflicts between parameters recommended in the platformspecific notes and the general recommendations below the platform specificrecommendations have precedence.

The java parameters have to be set via ConfigTool, see note 710146.

Remark: for adjusting of the SDM Heap see note 879377.

o 1. Java version

30.11.2010 Page 2 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

It should be the most actual one from the 1.4 family. J2EE Engine 6.40/7.0is not supported on 1.3 or 1.5 Java plattform.

Details on the currently recommended versions and how to get themcan be found in the above OS-specific notes.

Refer to note 718901 about changing of the JDK, see also 731269.Please apply note 754699 after JDK upgrade.

The following heap size recommendation is not valid for IBM eServerSystem i. Follow SAP notes 717376 or 1234382 respectively only onthat platform.

o 2. Heap size2.1 For 32 bit platforms we recommend to start the server nodes with 1GBwhereby the initial and the maximal heap size should be equal: -Xmx1024m -Xms1024mHigher values may cause troubles, for example see notes 736462 and 664607about Windows DLLs preventing big java heap.We recommend using additional server nodes instead of huge heaps.For 64 bit platforms (that means not only your OS but also your JDKsupports 64 bit) we recommend using 2GB: -Xmx2048m -Xms2048mTake into account while planning your productive landscape: for NW 7.0(04s) there is a general recommendation to use 64bit systems, see note996600.2.2 For dispatcher nodes it's sufficient to set the heap size to 171m on 32bit and to 256m on 64 bit platforms. There is no need to apply theparameters mentioned under 4-9 below.Default size of the young generation (one third of the heap) is ok fordispatchers.If the instance contains more than three server nodes we recommend to add50MB of dispatcher heap for each additional server node.

2.3 The max heap size (plus max perm size) of all Java server nodesmust fit completely into the physical memory in order to avoid heavypaging on OS level. You must also consider the space needed for OSand other processes.

For each JavaVM on the server, all Java memory must fit completelyinto physical memory (no paging)!Therefore the rule of thumb for number of server nodes for SUN and HPJavaVM on 32 bit with 1 GB Heap each will be#ServerNodes = (AvailableMemory / 1.5 GB).On 64 bit platforms the situation is a bit more complicated as we need totake into account the amount of memory needed for threads. For example on32 bit Windows the thread stack was 256K and therefore 100MB was sufficientfor 400 threads, therefore we could neglect them in the calculation. Butfor some 64 bit platforms the stack size is considerably higher. Forexample for 64 bit Windows it's 2 MB, therefore 400 threads sum up to 800MB. See Note 710154.For other platforms please refer to OS spesific notes listed on top. Thenumber of threads depends on the configuration which dependsin its turn on the deployed usages. There are two standard thread pools inthe engine (system and application, see ThreadManager and

30.11.2010 Page 3 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

ApplicationThreadManager in configtool), but different applications likeEP, KM, UWL, etc. add their own threads.You can check the number of threads currently used by your jlaunch processwith OS tools, e.g. TaskManager/ProcessExplorer, lsof, ps -L command, andso on.If we roughly assume that the j2ee engine uses up to 400 threads the worstcase calculation ends up with 3.3 GB per server node.

o 3. Verbose GCPlease always use -verbose:gc option for server and dispatcher.

The below paragraphs 4-9 only apply for HotSpot VM, i.e. Windows,Solaris, HP and Linux (with SUN JDK) but not for IBM platformsSpecial remark for AIX: please refer to Note 716927 for advanced tuning ofEP and XI.

o 4. Client or Server VM?We recommend using Server VM, it's default in most cases.Since the Client VM is not available for some platforms (usually a 64-bitVM only has the Server variant) we can't switch to the Client VM as it wasrecommended for EP6 SP2 running on JDK 1.3.1.The Server VM crashes should be reported to the VM provider (SUN or HP) andinvestigated. In some cases they can be avoided by excluding some classesfrom compilation (e.g. note 716926). For this purpose we recommend-XX:+PrintCompilation flag.Remark 1: please don't use "-server" or "-client" command line parameters,SAP J2EE Startup Framework doesn't accept them. The VM type should be setby the entry jstartup/vm/type in the instance profile, e.g.jstartup/vm/type=server, if necessary.Remark 2: R/3 profile maintenance transaction is not aware about abovejstartup/vm/type parameter, therefore you have to add it manually.Remark 3: You don't really need to select Server VM explicitly because SAPJ2EE Startup Framework loads it by default. This option is not for the JavaVM itself but for java launcher (e.g. java.exe or Startup Framework) thatdecides which jvm.dll (or libjvm.so) should be loaded. Server VM is thedefault choice for java launcher on almost all plattforms with someexceptions like 32-bit Windows, and on some plattforms it is the onlyavailable choice. Anyway, Startup Framework loads Server VM by defaultunless instance profile entry jstartup/vm/type is set to a different type.Compare with note 722520 about True64 where the above profile entry shouldbe set to fast64.

o 5. New Generation5.1 NewSizeAs before (compare to note 696410) we recommend setting both NewSize andMaxNewSize to approximately 1/6 of the heap, for example-XX:NewSize=171m -XX:MaxNewSize=171m for 1 GB heap size and-XX:NewSize=341m -XX:MaxNewSize=341m for 2 GB heap site5.2 Survival SpaceWe recommend -XX:SurvivorRatio=2 -XX:TargetSurvivorRatio=90The first options controls how big is eden space compared to survivor space(the latter contains two semispaces); the second option sets the desiredpercentage of the survivor space heap which must be used before objects arepromoted to the old generation.

o 6. Permanent Space

30.11.2010 Page 4 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

For 6.40 on 32 bit: -XX:MaxPermSize=192m -XX:PermSize=192mFor 6.40 on 64 bit: -XX:MaxPermSize=384m -XX:PermSize=384mFor 7.0 on 32 bit: -XX:MaxPermSize=256m -XX:PermSize=256mFor 7.0 on 64 bit: -XX:MaxPermSize=512m -XX:PermSize=512m

Remark 1: Be aware of the fact that more permanent space is needed ifadditional applications are deployed or the complexity of the applications(roughly speaking number of classes) grows.

Remark 2: increasing of the heap size or permanent space is harmless on 64bit systems (given that enough physical memory is available, see paragraph2.3 above) however on 32 bit ones (especially Windows) one should take intoaccount limitations of the virtual address space, see notes 664607 and736462.

o 7. Garbage Collector options7.1 Parallel minor GCJDK 1.4 contains several implementations of the garbage collector.We recommend -XX:+UseParNewGC option. It parallelize (and theforeaccelerates) minor GCs.7.2 Other non-standard GC optionsWe still do NOT recommend -XX:+UseConcMarkSweepGC (it caused VM crashes inearlier JDK 1.4.2 versions) but we're re-evauating it now based on mostactual JDKs.Because triggering GCs explicitly by Java applications could harm serverperformance significantly we recommend to set -XX:+DisableExplicitGC inorder to ignore such calls.7.3 GC utility options a. Please set also -XX:+PrintGCTimeStamps (available since JDK 1.4). b. -XX:+PrintGCDetails is very useful and doesn't have any negativeeffect, therefore highly recommended. c. In problem case you might be asked to use also the following option:-XX:+PrintTenuringDistribution d. Option -XX:+PrintCompilation shouldn't be used by default (because itproduces much output and makes logs less readable), but only in case oftroubles with JustInTimeCompiler (JIT).7.4 Thread local allocationWe recommend -XX:+UseTLAB option which switches on thread local allocationof objects. On Solaris and HP-UX you don't need to specify this switchexplicitly (it's used by default) but it doesn't harm also if you set it.On Windows and Linux you have to do this explicitly.7.5 Workaround for SUN bugs 6206427 and 6226790 which are not fixed in JDK1.4.2 familyUpgrade your JDK to 1.4.2_12 (or higher) and use the following additionaloption together with -XX:+UseParNewGC: -XX:+HandlePromotionFailureThis should help against crashes like[GC 327539.115: [ParNewException java.lang.OutOfMemoryError: requested 85287040 bytes forpromotion. Out of swap space?7.6 -XX:+PrintClassHistogram is useful for memory problem analysis (beaware that on HPUX it works properly starting with 1.4.2_10).7.7 Using full Heap dump feature for analysis of memory problems:this is an even more powerful feature, refer to note 1004255 for moredetails.Remark on -XX:+PrintClassHistogram and -XX:+HeapDumpOnCtrlBreak:be aware that both options use thread dump event to trigger some additionalactivity. First of all, both of them trigger Full GC. Second, it takes some

30.11.2010 Page 5 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

time to dump the histogram table and the entire heap. Therefore threaddumps shouldn't be made too often if one of the above options is used. Forexample scheduling thread dump every two seconds will make your systemfully busy with itself and inavailable just because it executes Full GCevery time.

o 8. SoftReferences -XX:SoftRefLRUPolicyMSPerMB=1 is still recommended

o 9. JIT Compiler Code CacheIn order to avoid a memory shortage of the JIT compiler code cachefollowing values are recommended: -XX:ReservedCodeCacheSize=64M -XX:CodeCacheMinimumFreeSpace=2M

o 10. System PropertiesRemark: If not stated otherwise the following settings are valid forservers on all platforms.10.1 Disable canonicalization optimizationWhen using Knowledge Management the setting -Dsun.io.useCanonCaches=falseis required to guarantee functional correctness of CM repositories and filesystem repositories with file system persistence. This setting is necessaryfor Windows, HP-UX, Solaris and Linux platforms using the Hotspot VM.10.2 Thumbnail generation on Linux and UNIX platformsImage generation for JSP and servlet applications on Linux, Solaris, AIX,IBM i and HP-UX must run in a "headless" environment - that is, on acomputer that lacks framebuffer hardware. This is not needed (but doesn'tharm if set) for Windows.Headless mode must explicitly be enabled as follows: -Djava.awt.headless=true10.3 Security settingsThe right security policy has to be set with-Djava.security.policy=./java.policy (on dispatcher too).The source of seed data for SecureRandom, which provides acryptographically strong pseudo-random number generator is set with-Djava.security.egd=file:/dev/urandom (except AS/400).10.4 jARM MonitoringWith -Djco.jarm=1 jARM monitoring for the SAP Java Connector is turned on.10.5 CORBA settingsFollowing properties have to be set:-Dorg.omg.CORBA.ORBClass=com.sap.engine.system.ORBProxy-Dorg.omg.CORBA.ORBSingletonClass=com.sap.engine.system.ORBSingletonProxy-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.sap.engine.services.ts.jts.ots.PortableInterceptor.JTSInitializer-Djavax.rmi.CORBA.PortableRemoteObjectClass=com.sap.engine.system.PortableRemoteObjectProxy

Note that the ORBInitializerClass is specified with a "." and not with a"=" symbol as the rest of the properties. This is according to the CORBAspecification.

Header Data

Release Status: Released for CustomerReleased on: 14.06.2010 09:30:49Master Language: English

30.11.2010 Page 6 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

Priority: Recommendations/additional infoCategory: FAQPrimary Component: BC-JAS Java Application Server - Please usesub-components

Secondary Components:EP-SYS-PERF Performance

EP-KM-CM KM Content Management

Valid Releases

Software Component Release FromRelease

ToRelease

andSubsequent

EP-PSERV 6.0 6.0 6.0

SAP-JEE 60 6.40 6.40

SAP-JEE 7.00 7.00 7.02

Related Notes

Number Short Text

1426759 Downloading the JCE Policy Files from SUN or IBM

1416629 UME Consistency Check Tool is causing OOM exception

1409804 Compilation fails with exception in Web service component

1406548 Recommended Settings for the Linux on POWER JVM (IBM J9 VM)

1405783 Build of migrated NW04s proxies fails silently

1405732 "OutOfMemoryError: Java heap space" in Web service component

1404134 Compilation fails with memory issue in Web service component

1339434 SAP PMM by Vendavo JVM Settings

1300247 SCPM 1.0 Performance

1295744 XI/PI Java Components: JVM Perm Size Memory Usage

1248926 AS Java VM Parameters for NetWeaver 7.1 based products

1243038 High CPU Utilization on Access Control server

1234382 IBM i: VM Settings for SAP WebAS Java (IBM J9 JVM)

1230512 End of Life of Sun's J2SE 1.4.2

1229300 DB2-z/OS: com.ibm.db2.jcc.c.DisconnectException

1149693 Duet 1.5 SP01: Release Information Note

1137949 Engine does not start on AIX due to DB connection problems

1121978 Recommended settings to improve peformance risk analysis

1079225 SAP NetWeaver 2004s SPS12, Updating VM parameters

1079125 EWA GCA Task of Solution Manager Diagnostics

1075118 SAP on HP-UX: FAQ

1054151 JDK garbage collector profiling on HP-UX

1052298 Inst.NW 7.0 SR3/Business Suite 2005 SR3-UNIX

1046865 SAP ERP 6.0 SP Stack 10 (07/2007) Release Information Note

1046863 SAP ERP 2005 SP Stack 09 (05/2007) Release Information Note

1044330 Java parameterization for BI systems

1044173 Recommended Netweaver Settings for Access Control 5.X

1034117 Management Reports run too long, not updating, or inaccurate

30.11.2010 Page 7 of 7

SAP Note 723909 - Java VM settings for J2EE 6.40/7.0

Number Short Text

1004255 How to create a full HPROF heap dump of J2EE Engine 6.40/7.0

999785 Background Daemon will not Start

996600 32 Bit platforms not recommended for productive NW2004s apps

972262 Inst.NW 7.0(2004s)SR2/Business Suite 2005 SR2-UNIX

972113 mySAP ERP 2005 SP Stack 6 (09/2006) Release Information Note

956760 Central note SAP NetWeaver 2004s Rapid Installer for SPS 08

954973 SRM 5.0 SP-Stack 05 (07/2006) (SAPKIBKT05): Release/Info Not

941465 Central note SAP NetWeaver 2004s Rapid Installer for SPS 07

927530 BI Java sizing

919270 Central note SAP NetWeaver 2004s Rapid Installer for SPS 06

905211 PCD Cache Optimizer Tuning

889038 Collective note: NWDI server component configuration

879377 How to adjust the JVM parameters used by SDM?

861333 Very slow start of the j2ee engine on AIX with 64bit IBM JDK

861215 Recommended Settings for the Linux on AMD64/EM64T JVM

855297 (outdated)SAP ERP 2005 Installation on UNIX

851251 (Outdated) SAP NetWeaver 2004s Installation on UNIX

848950 SAP NetWeaver 2004s Installation on Windows (Obsolete)

844017 Central Note - Application Delivery over WAN 2.0 Patch 1

840524 NWDI server configuration: J2EE engine/Java VM parameters

808869 Java Components for mySAP ERP 2004 SR1

807406 MDM 3.00 SP03: Release and info note (SAPK-30003INMDM)

772752 Fine tune performance of NW04 EP 6.0 on WebAS 6.40

764215 Problems with big java heap when started via jlaunch.exe

754699 Problems with User Mapping after changing JDK

739788 SAP NetWeaver: Template-Based Configuration - Composite Note

739263 NW04 SPStack Installation:Content Management & Collaboration

734479 Central Note - EP 6.0 SP6 w/ NW04 SP Stack 04 (Feature Pack)

731269 Changing JDK Version with the Offline Config Tool

718901 How to Change the JDK of the J2EE Engine

717376 iSeries: VM Settings for SAP WebAS Java (IBM Classic JVM)

716927 Overview of AIX JVM for NetWeaver 2004 and 7.0 (2004s)

716926 Recommendations for the HP JDK

716604 Access to Sun J2SE and recommended J2SE options

710146 How to change J2EE Engine JVM Settings

709140 Recommended JDK and VM Settings for the WebAS630/640/7.0

664607 Hot Fixes or patch sets with fragmenting DLLs

171356 SAP software on Linux: Essential information