logo
24.1
search
No matching documents found.
list
search
No matching documents found.
logo

Idle Instances

This feature allows you to define a number of instances (sessions) to be started before user requests to start a new instance. The purpose of idle instances is to reduce the time user has to wait for the JVM startup. You can configure how many idle instances should be available at all times in app config in Admin Console. Note that idle instance is application specific.

Idle instances config

You can see a list of currently running idle instances in Sessions view.

Idle instances list

When you change your app's configuration, idle instances are automatically recreated.

Pre-launch

There are multiple ways to configure Idle application launch of a Desktop application. In Webswing app configuration next to Desktop Launcher Type you can find field called Pre-launch. This field has 3 options.

Pre-launch configuration

NONE The launch of idle instance stops right before calling the main class defined in the app launch configuration. The main class of your app will be called after the user requests a new instance.

MAIN_CLASS This option launches the idle instance fully including calling the main class defined in app launch configuration. When user requests a new instance, the instance will be instantly ready to be used. Note there are restrictions for this option, read below.

CUSTOM This option allows you to launch another pre-launch main class. The launch of idle instance stops after this call and before the main class defined in the app launch configuration (full main). You can do any kind of initialization you need to speed-up the startup of the full main, for example loading backend services. Make sure to check in your full main if pre-launch main already finished.

Restrictions

There are some restrictions for usage of idle instances. Since the idle instance is started before user requests the instance, it is not possible to use user supplied variables in the following configuration parameters:

  • userDir
  • javaFxClassPathEntries
  • javaVersion
  • jreExecutable
  • vmArgs
  • classPathEntries
  • sessionLogFileSize
  • sessionLogMaxFileSize

If you have any user supplied variables during an idle instance startup, you will see a warning in logs, which tells you which variable could not be replaced so that you can fix it.

If you need user supplied data to be available as system properties during the call of your main class, please use launcherSystemProperties configuration property in app config.

If you are using MAIN_CLASS option for Pre-launch, it is not possible to use any user supplied variable during the instance launch. If you need to send user supplied data to an already fully pre-launched idle instance please use JsLinkDirect.

Cluster

In cluster environment the number of idle instances configured applies to a session pool. If you configure 3 idle instances, every session pool will create 3 idle instances. If you want to restrict the number of idle instances for a session pool, you can change the value of sessionpool.instances.maxIdle parameter in webswing-sessionpool.properties. You can also disable idle instances for a specific session pool with sessionpool.idleAllowed parameter.

You can see the number of idle sessions running in session pool in Overview.

Idle instances overview