• No results found

Brief Introduction to Memory Management of the SAP Java VM

A number of terms for the memory management of an SAP Java Virtual Machine (SAP JVM) are explained in the following sections in a simplified form. The configuration of the VM parameters will then be discussed.

Memory Allocation Terms

The memory area of a Java Virtual Machine (JVM or VM) is mainly divided into three areas, which are called the young generation, the tenured generation, and the permanent generation. The differences between the “generations” are discussed in more detail later. We will first consider the commonalities, however. A “generation”

reserves space in the address area of the host.

On start-up, the Virtual Machine allocates operating system memory for each

“generation”. This initially allocated memory area is called “initial” or initial size.

This occupancy of this space is administered internally by the VM.

Once the initial space has been used, the VM allocates further operating system memory space in stages up to a maximum amount. This maximum value is defined in “max size”.

The VM automatically takes care of the allocation of memory space for Java applications. The memory space is implicitly assigned when an object is created.

Even if a large amount of memory is required, this does not mean that the system is at risk. The VM determines which objects are no longer used and releases the memory areas which they currently occupy. This task is performed by the Special Java Agent names Garbage Collector (GC) which forms part of the VM. Its job is to prevent the occurrence of situations in which there is a danger of memory bottlenecks.

The memory space that is available is called the available memory or allocated memory. Since this space is reserved by the operating system, it is also referred to as

confused with the “virtual memory” of the operating system. If less space is required, the memory is returned to the operating system, also in stages. See the figure “Terms in Memory Space Management” also.

The reserved memory space (available memory) is potentially available to the VM.

However, it does not have to be used in full. The memory space that is actually used by Java applications is referred to as used memory.

Figure 55: Terms in Memory Space Management

Memory Allocation of the Java VM in a Simplified Form

The three main memory areas of the VM, the “young, tenured”, and “permanent generations” differ from one another due to the data stored in them. The objects that have been newly created by the applications are stored in the young generation.

Objects that have been required for a longer period of time by an application are automatically moved to the tenured generation. The newer objects are in the “young generation” and the older objects are in the “tenured generation”. Objects that are permanently required by the VM, such as classes and methods, are stored in the permanent generation. Objects that are no longer required by the applications are automatically removed from the “generations”. This process is known as garbage collection.

As you already know from the subsection “Memory Allocation Terms”, the

“generations” have an initial and a maximum size. For the “young generation”, you can define the “initial size” with the parameter -XX:NewSize, and the “max size”

with the parameter -XX:MaxNewSize. You can define the corresponding values for the “permanent generation” (also abbreviated to the “perm generation”) with the parameters -XX:PermSize and -XX:MaxPermSize. You cannot directly define the

initial and maximum sizes of the “tenured generation”. These are calculated from the parameters for the “young generation” and the parameters -Xmx and -Xms. The parameter -Xmx is called the “max heap size” and defines the total size of the “young”

and “tenured generations”. The parameter -Xms is called the “start heap size” or

“initial heap size” and defines the total initial size of the “young” and “tenured generations”. See also the figure “Memory Allocation of the Java VM (Simplified)”.

Figure 56: Memory Allocation of the Java VM (Simplified)

In addition to the memory area for the “generations”, the VM also reserves space for its processes and threads.

After this brief introduction to the basic terms of the SAP JVM, we can now take a look at the configuration of the VM parameters.

Configuration of the VM Parameters

The settings for the Java VM (Virtual Machine) are maintained only with the Config Tool. You can maintain the VM parameters at template level or individually for each instance. The values then apply either to all server processes of the entire system (template level) or to all server processes of the respective instance. You must switch to Expert Mode of the Config Tool in order to maintain VM parameters at template level. Choose View and select the option Expert Mode.

Note: You should only activate Expert Mode if it is absolutely necessary. As a result, the UI of the Config Tool becomes more confusing. The normal

To maintain the VM parameters at template level, select the entry template

-<name of the template> from the area on the left. You can choose the tab page VM Parameters in the Config Tool window on the right after you activate Expert Mode.

You must now decide which combination of VM and operating system or processor architecture your changes are valid for; for example Vendor sap and Platform ntamd64. Then choose one of the tab pages Memory, System, or Additional, depending on which type of VM parameter you want to maintain.

Note: You cannot create new parameters on the Memory tab page; you can only change or deactivate existing ones.

You can enter parameters of the type -D.... on the System tab page. However, leave out the -D here.

Figure 57: Maintaining the VM Parameters: Template Level

If you want to add a new parameter that is not yet in the parameter list, choose New in the lower area of the window on the right. The new parameter is added in the area Custom Parameters.

You must select a parameter if you want change it. Enter the new value for the parameter in the input field Custom value and choose Set. The changed value is in turn displayed in the list of the Custom Parameters. To return to the default value, select the custom parameter and choose Remove.

You can also deactivate existing parameters. In this way, you can test the effects of the change on the system but retain the entry with the set value. To do this, select the parameter and choose Disable. If it is a template default value, the Config Tool enters the value (if requested) as a custom parameter, which is then deactivated (checkmark in column Enabled is missing). You can use Enable to reactivate a deactivated parameter.

Hint: Any change with the Config Tool must be saved (File → Apply Changes and the system must be restarted for the changes to take effect.

The settings at instance level override those at template level. Select an entry of the type instance - ID<instance ID> (host name) from the window of the Config Tool on the left. Then choose the tab page VM Parameter from the window on the right.

The parameters are maintained in the same way as at template level. You are advised to deactivate Expert Mode when maintaining the VM parameters. This way you can ensure that you are maintaining the parameters for the VM that is currently being used.

If you have changed settings but not yet saved them with Apply changes, you can reload the older settings with “Connect to DB”. If you have already saved the changes, the old settings cannot be restored.

Figure 58: Maintaining the VM Parameters: Instance-specific

The parameter in the Memory tab page does not have its technical name. The following names are used in the Config Tool.

Names of the VM Parameters of the type Memory Display name in the Config Tool Technical name

initialHeapSize Xms

maxHeapSize Xmx

permSize XX:PermSize

maxPermSize XX:MaxPermSize

newSize XX:NewSize

maxNewSize XX:MaxNewSize

newRatio XX:NewRatio

globalArea Xps

Take a look in the developer trace of the server process (dev_server<number>) to check whether the changes that were made have taken effect in the respective server processes after the system is restarted. This file is located in the work directory of the instance. Search for the line F SAP JVM arguments: in this file. The set parameters are listed under this line.

Related documents