My FNZ Studio Version

System Maintenance

Latest Update: 08.03.2024 |
Recipe
2023
2022.2
2022.1
11
10
9
8

Problem

I have to implement a safe procedure to shut down a large cluster.

What options do I have, and what things do I need to take into consideration?

Solution

There are two fundamentally different ways to stop an Appway cluster:

(a). One node after the other
(b). All nodes at the same time

Each approach has different advantages and disadvantages, outlined below. You are strongly advised to use the second approach — that is, shut all nodes down at the same time — using one of the three options covered in Section B below.

a. Shutting down a large cluster: One node after the other

While this approach is possible, it is not recommended due to the following issues.

There are multiple disadvantages:

  • Duration — It takes a long time: You have to wait for a node to stop before continuing with the next node, and so on.
  • Memory — It requires a rebalancing of the data in memory several times: Once per node, except for the last node.
  • Race conditions —This approach is prone to race conditions: One of the still-running nodes might trigger a job which could interfere with the stopping node.

b. Shutting down a large cluster: All nodes at the same time

The one disadvantage of this approach is:

  • A requirement to explicitly trigger an Appway Cluster Shutdown before stopping the application servers

In summary, this second approach is a lot cleaner and faster because the in-memory data layer is disconnected simultaneously on all nodes. No rebalancing of the data in memory is therefore required.

Furthermore, larger installations may necessitate the use of approach (b); approach (a) requires that a single Appway node can hold all the data in the distributed maps.

Triggering an Appway Cluster shutdown — all nodes at the same time

Publishing a shutdown sends a shutdown command to all cluster nodes to initiate an Appway-internal shutdown procedure on every node. HTTP requests sent to Appway after this moment are blocked.

Each node stops its services and then prints the following message in the log files: "Appway will soon be stopped, but the Application Server might continue running..."

Note that, in Appway11.1 and higher, JVM shuts down by default when the Appway cluster is shut down. You can revert the default JVM shutdown behavior by setting the nm.cluster.shutdown.jvm.stop configuration property to false.

There are three options available to implement a shutdown :

  1. Use the Appway REST service to publish a shutdown.
    To do so, call ${baseURL}/rest/cluster/shutdown on any node.
    More information can be found in the REST interface documentation.

  2. Use the ClusterServiceInfo JMX bean to publish a shutdown.

    • Connect to the JMX management server running on any node
    • Go to the ClusterServiceInfo JMX bean under com.nm/Cluster
    • Call publishShutdown()
  3. Use an Appway script to publish a shutdown.

Use the Interactive Script Editor or the script execution job extension to call the following code:

CONTEXT().getClusterService().publishShutdown()

Note that the Script Function above is not available for FNZ Studio 2023 LTS and higher. A replacement is being developed.

A good example of automation already in practice is that of implementing approach (b) with option 2 (calling the JMX bean):

  • A newly-created UNIX script wraps the application server stop script
  • This new script first calls JMX to publish a shutdown
  • The script then waits until the debug log on all nodes shows "Appway will soon be stopped, but the Application Server might continue running..."
  • After this log message is produced on every node of the cluster, it calls the application server stop script
© 2026 Appway AG. All Rights Reserved