Child pages
  • Memory Management

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Servoy is built using Java technology and as such the memory management for Servoy is basically Java Memory management. This chapter describes the basics of Java Memory management, which will be sufficient for all but the most extensive and complex Servoy environment. deployment scenario's.

Java Memory management introduction

...

  • A Java process uses several memory spaces (called the Perm Space or Heap Space for example), each of which use a dedicated block of memory
  • For each space the Java process determines the initial and maximum amount of memory it is allowed to use, of not explicitly specified through configuration. The defaults values differ per JVM implementation and can depend on the hardware on which the JVM is started.
  • The initial and maximum's for each space can also be explicitly specified through configuration
  • The initial memory sizes for all spaces are allocated at startup of the Java process
  • The Java process will allocate more memory only when required, up the specified maximum per space
  • Allocated memory that is not used anymore will periodically be released in a process called Garbage collection. In Java this is a fully automated process
  • If the Java process requires more memory than the maximum in any of the spaces, the Java process will throw a relevant exception, for example an OutOfMemory or Stack Overflow exception. These exceptions should be prevented as they both degrade performance, but more importantly can cause unexpected behavior.

Balancing act

...

  • .

...

Java Memory spaces

The two most important spaces of memory that a Java process uses are the Java Heap Space and the Java Perm Space. 

...

The memory footprint is not linear with the number of Forms a Solution contains, as Forms are instantiated on a need-to basis.

As there is no way to determine up front how much memory a Web/Headless/Batch Processor Client will use, the only way to dimension the memory correctly is by monitoring and tuning it.

For the initial dimensioning, use the following rules of thumb:

  • Small solution (1 - 50 forms), simple user interface: 5Mb
  • Medium size solution (50 - 500 forms), average complex user interface: 10Mb
  • Large solution (> 500 forms), complex user interface: 20Mb

Configuring the memory settings

By default the maximum heap size is set to 256MB. This setting should be changed when:

  • The expected load is higher (see previous paragraph for determining the expected load)
  • The actual used memory is >= 70% of the specified maximum. The actually used memory can be found on the main page of the Admin page, under System Information, like: Heap memory: allocated=549184K, used=371473K, max=699072KWhen the expected client load will exceed the maximum. Using the following rule of Thumb: Smart Client: assume a memory usage of about 600kb for each Smart Client. NOTE:
  • When the Servoy HTTP Tunnel is used, assume 900kb per Client.
  • All other type of Clients (Web, Headless, Batch): the required memory for each client depends on the size and design of the solution, but should be in the order of magnitude of a couple of Mb per Client.
  • When there is plenty of free real memory available on the OS level. Java processes in general perform better when not having memory constraints. For example, when 2Gb free real memory is left, add the 2Gb to the maximum heap size. The Java process will only take what it needs.

There is a big difference in  

...

HTTP Tunnel usage

...

32bit Java Mem assignment limitations

...

Configuring the memory settings

Depending on how the Servoy Application Server is started, the Memory setting need to be applied in a different location.

...

Manual start: servoy_server.bat/.sh

...

When starting the Servoy Application Server manually through {serverInstall}\application_server\servoy_server.bat/.sh, the memory settings for the Application Server can be configured inside servoy_server.bat/.sh:

Code Block

java -Djava.awt.headless=true -Xmx256m -Xms64m -XX:MaxPermSize=128m .....
Auto start: wrapper.conf

When using the Service component to automatically launch the Servoy Application Server when the machine on which it is installed is booted, the memory settings for the Application Server can be configured inside {serverInstall}\application_server\service\wrapper.conf:

Code Block

wrapper.java.additional.4=-XX:MaxPermSize=128m
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=32
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=256

For more information on configuring the Service component, see Running the server as a service

Starting in Servoy Cluster: start_servoy_clustered.bat/.sh

When the Servoy Application Server is part of a Servoy Cluster, the memory settings can be configured in {serverInstall}\application_server\terracotta\start_servoy_clustered.bat/.sh

...

:

Code Block

-Xmx256m -Xms64m -XX:MaxPermSize=128m

...

32bit Java Mem assignment limitations

...

(warning)  When the Servoy Application Server runs under a 32 bit JVM the maximum amount of memory that can be assigned to the Java process is 2Gb. This is a limitation of 32 bit. In order to be able to assign more memory, a 64 bit environment is required.

Smart Client Memory management

...

Virtual Machine Arguments

TODO

The maximum heap size setting is located in ../application_server/servoy_server.sh/.bat, through the "Xmx" setting.

When the Application Server is started as a Service the setting can be found in ../application_server/service/wrapper.conf, by the name of "wrapper.java.maxmemory".

Java Virtual Machine (JVM) Tuning

...