Suspending and resuming WildFly

One useful feature of WildFly is the ability to suspend and resume the server, which allows you to temporarily stop the server from accepting new requests and resume it when needed. This can be useful in a variety of scenarios, such as when you need to perform maintenance on the server or deploy a new application.

In this tutorial, we will take a closer look at the suspend and resume feature of WildFly and show you how to use it from the command line. We will also discuss some of the benefits and potential use cases for this feature.

How to suspend and resume WildFly from the CLI

Firstly, connect to the Command Line Interface.

./jboss-cli.sh

Next, from the CLI and execute:

:suspend

Then, you can check the Server status from the Console or Server logs. For example:

wildfly suspend resume tutorial

You can also specify a timeout, to force requests to complete by that time:

:suspend(timeout=60)

In Domain mode, to suspend all servers:

:suspend-servers(timeout=60)

In Domain mode, to suspend a single server:

/host=master/server-config=server-one:suspend(timeout=60)

What exactly happens in the subsystems when WildFly has been suspended?

  • undertow: The undertow subsystem will wait for all HTTP/HTTPS requests to finish.
  • mod_cluster: The modcluster subsystem will notify the load balancer that the server is going to be suspended.
  • ejb: The ejb3 subsystem will wait for all remote EJB requests and MDB message deliveries to finish. However, delivery to MDBs is stopped in the PRE_SUSPEND phase. EJB timers are suspended as well.
  • JEE Concurrency: The server will wait for all active jobs to finish. All queued jobs will be skipped.

Therefore, when you are in suspend mode you are still able to:

  • Deploy/undeploy applications
  • Change your configuration

You can check at any time the status of your server by issuing an ls at the root of your configuration:

[standalone@localhost:9990 /] ls
core-service                 name=francesco-pc
deployment                   namespaces=[]
deployment-overlay           process-type=Server
extension                    product-name=WildFly Full
interface                    product-version=9.0.0.Beta2
path                         profile-name=undefined
socket-binding-group         release-codename=Kenny
subsystem                    release-version=1.0.0.Beta2
system-property              running-mode=NORMAL
launch-type=STANDALONE       schema-locations=[]
management-major-version=3   server-state=running
management-micro-version=0   suspend-state=SUSPENDED
management-minor-version=0

On the other hand, new application requests will receive a:

wildfly 9 tutorial

Once completed the running requests, you can either shutdown the server or resume the execution with:

:resume

How to suspend/resume WildFly from the Web Console

You can also perform the same management operations from the Web Console of the application server.

  • Log into the Server Console
  • Select the Runtime Tab
  • In the Server Column, right-click on the View Combo and choose the Action to perform:
jboss how to suspend

Conclusion

This article was a walk trough the management of the application server and how to suspend and resume the execution of core application services

Found the article helpful? if so please follow us on Socials