Child pages
  • Memory Management

Versions Compared

Key

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

...

The Perm Space is the space used by Java to store the loaded classes and other static things, so if you have many plugins and support libs, it is possible that this should be increasedobjects. The setting related to the Java Perm Space is only the following.

...

(warning)  The above mentioned settings are settings that can be applied when launching a Java process command-line or form a .bat/.sh script. Certain application might provide other ways to specify the same settings, for example the Service component that is part of the Servoy distribution. For more information on how to configure these settings withing Servoy, read the next paragraph.

Server Memory management

Memory management for a Servoy Application Server revolves around managing the values for the Java Heap Space and Java Perm Space.

Depending on how the Servoy Application Server is launched, the location where these values can be managed differs:

  • Started using the Service component > {serverInstall}\application_server\service\wrapper.conf
  • Manually started stand-alone > {serverInstall}\application_server\servoy_server.bat/.sh
  • Manually started in Servoy Cluster >  {serverInstall}\application_server\terracotta/start_servoy_clustered.bat/.sh

Determining the required

...

Java Heap Space value

The components that contribute to the Java Heap Space requirements for a Servoy Application Server consists of the following parts:

  • The Servoy Application Server itself
  • The memory usage related to active/idle database connections
  • The memory usage related to running Servoy Clients

The memory usage of the a standard Servoy Application Server itself is limited to a couple of Mb.

For the database connections assume 2Mb per connection, so sum the Maximum Active connections settings on each configured and enabled Database Server and multiply that by 2Mb to determine the maximum memory consumption by the all database connections

The memory usage for the running Servoy Clients is more difficult to obtain, as it depends on the number of running Clients, the type of the running Servoy Clients, the way the Servoy Solutions that are running are built and the way the users use the these Solutions. These variables together make it difficult to provide hard numbers on how to configure the memory settings beforehand. Getting it right means monitoring and tuning.

...

  • Smart Client using the Servoy HTTP Tunnel:  assume 900kb for each Smart Client
  • Smart Client using another connection mode than the HTTP tunnel: assume 600kb for each Smart Client
  • Web Client, Headless Client (incl. the RESTfull plugin connection poolsize) & Batch processors: 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. For more guidelines, see below.

...

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

Configuring the

...

Java Heap Space value

The setting that requires tuning based on the determined required memory for the Servoy Application Server is the Maximum Heap Space setting (Xmx). By default the Maximum Heap Space is set to 256MB withing 1028MB within Servoy. This setting should be changed when:

...

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

Manual start: servoy_server.bat/.sh or ../terracotta/start_servoy_clustered.bat/.sh (

...

when running Servoy Cluster)

When starting the Servoy Application Server manually, either through {serverInstall}\application_server\servoy_server.bat/.sh or {serverInstall}\application_server\terracotta/start_servoy_clustered.bat/.sh, the memory settings for the Application Server can be configured inside servoy_serverthe .bat/.sh, by altering the -Xmx value:

Code Block
java ... -Djava.awt.headless=true -Xmx1280m -Xms64m -XX:MaxPermSize=128m .....
Note
titleSpecifying -Xmx and -Xms values

When specifying the -Xmx and -Xms values, the following needs to be taken into account:

  • The value can only be an integer value
  • The value needs to be places directly behind the parameter, no spaces or equal signs
  • The value needs to be post fixed with the unit: "m" or "M" for megabytes, "g" or "G" for gigabytes
  • When changing the -Xms options,  make sure that the -Xmx option has a higher value
  • Both values need to be lower than the available memory on the machine

By default the servoy server start files (wrapper or sh/batch) files will have the maximum configured of 1280m, it could be that this is to high for small servers, then you could get this errror:

"Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit."

please lower then the Xmx value to something that your server can handleIn a default Servoy Application Server installation, the Maximum Heap Space value (-Xmx) is set to 1280m. For servers that have limited memory, this value could be too high, resulting in the following error when trying to start the server:

Code Block

Error occurred during initialization of VM
Could not reserve enough space for object heap
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Either lower the -Xmx value or make sure that more memory is available for the Java process on the server, by closing other applications or adding more physical memory to the server.

32bit Java Memory assignment limitation

(warning)   An 32 bit JVM will allow a maximum memory assignment of 2Gb in total. In order to assign more than 2Gb of memory, a 64 bit JVM on a 64 bit OS is required.

Determining the required Java Perm Space value

By default the Java Heap Space size is set to 128Mb, which is a sufficient value for most deployments. A scenario in which this value needs increasing is when the Servoy Application Server is loaded up with a lot of additional plugins, beans, LAF's and drivers.

Configuring the the Java Perm Space Value

For all three scenario's that the Servoy Application Server can be started (as a service, manual stand-alone or manual clustered), the value for the Java Perm Space is controlled by the "XX:MaxPermSize" setting in the above mentioned configuration location.

Monitoring the Memory usage

...