Chapter 3. Controlling and Monitoring JEUS Servers

Table of Contents

3.1. Controlling and Monitoring Servers
3.1.1. Life Cycle of Managed Servers
3.1.2. Starting a Managed Server
3.1.3. Shutting Down a Managed Server
3.1.4. Suspending a Managed Server
3.1.5. Resuming a Managed Server
3.2. Server Engine Configuration
3.2.1. Option to Use an Engine
3.2.2. Engine Initialization Time Configuration
3.3. Controlling and Monitoring Threads
3.3.1. Thread Monitoring
3.3.2. Thread Control
3.4. Memory Monitoring and Control
3.4.1. Memory Monitoring
3.4.2. Memory Usage Control

This chapter describes how to control and monitor JEUS servers. Only managed servers (MSs) are covered in this chapter with the assumption that the Domain Admin Server (DAS), which manages the servers, is under normal operation. The tasks that are described here can also be performed in WebAdmin. The users who are unfamiliar with command lines are recommended to use WebAdmin.

Note

For more information about server startup scripts and jeusadmin console tool, refer to JEUS Reference Book. "Chapter 3. Starting JEUS Server" and JEUS Reference Book. "4.2.2. Local Commands".

3.1. Controlling and Monitoring Servers

This section describes how to control and monitor servers.

3.1.1. Life Cycle of Managed Servers

The following shows the possible state transitions of an MS. DAS or the user can change the state of an MS.

[Figure 3.1] State Transitions of a Managed Server(MS)

State Transitions of a Managed Server(MS)


ItemDescription
SHUTDOWNServer has not been started or has shut down normally.
STARTING

Server has received a start command and is in the process of starting up.

A server can be started by a startup script or the node manager. During startup, the server creates the engines(WEB, EJB, and JMS), starts JEUS services (security and SCF), and deploys registered applications, etc.

STANDBYAfter the required JEUS services have started on the server, if applications that are registered on the server fail to be deployed or distributed, the server goes into the STANDBY state.
RUNNINGA server has started and the registered applications are running normally. If a server that was in the STANDBY state is started by the force option, not all registered applications may be running.
SUSPENDING

A running server is in the process of executing the suspend command.

Except for listeners used for application services, all running services on all applications are stopped in this state.

SUSPENDEDAll applications that are deployed on the server are stopped. No services are running except for the listeners used for application services.
RESUMING

A server in the SUSPENDED state is in the process of executing the resume command.

All stopped applications are restarted and ready to provide services. After the execution of the resume command, the server goes into the RUNNING state.

SHUTTING_DOWN

A server is in the process of shutting down. The deployed applications are undeployed, and all JEUS services that were started at startup are terminated.

When a server is shutting down, a timeout setting is used to allow the currently running services to be processed. This is called a 'graceful shutdown'.

Note

1. For more information about the lifecycle of MSs managed by DAS, refer to ????.

2. For more information about graceful shutdowns, refer to "3.1.3. Shutting Down a Managed Server".

3.1.2. Starting a Managed Server

In JEUS 7, by default DAS and MS are started by a launcher. Server startup commands via a script or DAS is used to start the launcher, and the launcher prepares for the server startup and starts the server. For more information about the launcher, refer to ???. For information about how to start a server through DAS by using the console tool or WebAdmin, refer to JEUS Domain Guide. "4.2.2. Starting a Managed Server (MS)". Note that this section only describes examples of starting servers by using scripts.

Example

A launcher terminates after starting JVM of a server and confirming that the server has started. In the following example, the launcher log is used to confirm that the server has been started successfully.

JEUS_HOME/bin$ ./startManagedServer -domain domain1 -server server1 -u jeus -p jeus -dasurl localhost:9736
***************************************************************
  - JEUS Home         : /home/test/jeus
  - JEUS Base Port    :
  - Added Java Option :
  - Java Vendor       : Sun
***************************************************************
...
[2016.08.23 23:01:30][2] [launcher-1] [SERVER-0201] Successfully connected to the Domain Administration Server(localhost:9736).
[2016.08.23 23:01:30][2] [launcher-1] [Launcher-0058] All local configurations are up-to-date.
...
[2016.08.23 23:01:36][2] [server1-1] [SERVER-0248] The JEUS server is RUNNING.
[2016.08.23 23:01:36][2] [server1-1] [SERVER-0401] The elapsed time to start: 4283ms.
[2016.08.23 23:01:36][2] [launcher-11] [Launcher-0034] The server[server1] initialization completed successfully[pid : 20496].
[2016.08.23 23:01:36][0] [launcher-1] [Launcher-0040] Successfully started the server. The server state is now RUNNING.
JEUS_HOME/bin$ 

Problems may occur when an MS deploys its application files during startup. In such cases, an MS remains in the STANDBY state. The application files that are deployed during startup have been executed successfully one or more times. Hence, if there is a problem, then it is likely that the files have been modified incorrectly.

If the XML tag of the application in .workspace directory, an internal JEUS directory, is modified incorrectly, the server may remain in the STANDBY state as shown in the following screenshot. For more information about deployment of the domain structure, refer to JEUS Applications & Deployment Guide. "Chapter 1. Application Management in a Domain Environment".

Caution

Since applications are generally managed by DAS, the .workspace directory of the MS must not be accessed directly.

JEUS_HOME/bin$ ./startManagedServer -domain domain1 -server server1 -u administrator 
-p adminadmin -dasurl 61.77.153.160:9736
...
[2016.08.24 05:21:27][2] [server1-1] [SERVER-0248] The JEUS server is STARTING.
[2016.08.24 05:21:27][2] [server1-1] [Deploy-0095] Distribute the application[de
ployment_helloear].
[2016.08.24 05:21:27][2] [server1-1] [SERVER-0201] Successfully connected to the
Domain Administration Server(61.77.153.160:9736).
[2016.08.24 05:21:27][0] [server1-1] [STDERR] java.lang.RuntimeException: Unexpe
cted close tag </application>; expected </module>
...
<<__!Exception__>>
[2016.08.24 05:21:27][1] [server1-1] [SERVER-0300] Distributing some registered
applications [deployment_helloear] failed.
[2016.08.24 05:21:27][2] [server1-1] [SERVER-0248] The JEUS server is STANDBY.
[2016.08.24 05:21:27][0] [server1-1] [SERVER-0250] Starting server (server1) fai
led. Staying in STANDBY.
[2016.08.24 05:21:27][2] [server1-1] [SERVER-0401] The elapsed time to start: 9541ms.
[2016.08.24 05:21:27][2] [launcher-10] [Launcher-0034] The server[server1] initi
alization completed successfully[pid : 31068].
[2016.08.24 05:21:27][0] [launcher-1] [Launcher-0042] Comp
leted starting the server but the server state is still STANDBY.
JEUS_HOME/bin$

The server-info command can be used to verify that an MS is in the STANDBY state as shown in the following example.

[DAS]domain1.adminServer>server-info

Information of Domain (domain1)
===============================================================================================
================================================================================
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| Server|  Status |Node | PID | Clu |   Latest   |  Need  |   Listen  |Running |
|       |         |Name |     |ster | Start Time |   to   |   Ports   |Engines |
|       |         |     |     |     | / Shutdown |Restart |           |        |
|       |         |     |     |     |    Time    |        |           |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| admin | RUNNING | nod | 5716| N/A | 2016-08-24 | true   | base-0.0. | jms,   |
|Server |(04:24:1 |e1   |     |     | (Wed) PM   |        |0.0:9736   |ejb, web|
|(*)    |0)       |     |     |     |12:57:36 KST|        | http-serv |        |
|       |         |     |     |     |            |        |er-0.0.0.0 |        |
|       |         |     |     |     |            |        |:8088      |        |
|       |         |     |     |     |            |        | jms-0.0.0 |        |
|       |         |     |     |     |            |        |.0:9741    |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| serve | STANDBY | nod | 1820| clu | 2016-08-24 | false  | BASE-0.0. | jms,   |
|r1     |(00:00:1 |e1   |     |ster1| (Wed) PM   |        |0.0:9836   |ejb, web|
|       |8)       |     |     |     |05:21:27 KST|        |           |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
===============================================================================================

3.1.3. Shutting Down a Managed Server

An MS can be shut down using a jeusadmin command. It can be shut down using a local-shutdown command in jeusadmin that is connected to the MS. It can also be shut down using a DAS command in jeusadmin or the console tool.

For more information about how to shut down an MS, refer to JEUS Domain Guide. "4.3.1. Shutting Down a Managed Server (MS)" .

Note

Since DAS is set to manage an MS, it is recommended to use DAS to stop an MS.

Example

There is a function called graceful shutdown that guarantees the completion of the requests currently being processed before an MS shuts down. New requests are not processed. The server stops accepting requests after it receives the stop command, but the requests that are currently being processed are allowed to finish.

The following is an example of setting the wait time in the timeout option of the MS stop command.

[DAS]domain1.adminServer>stop-server server1 -to 60000
Server [server1] was successfully stopped.

It is also possible to set a wait time when the console tool is used to directly connect to an MS.

domain1.server1>local-shutdown -to 60000
The server [server1] has been shut down successfully.
offline> 

After the server shuts down successfully, the following message is displayed.

...
[2016.08.24 03:42:36][2] [server1-63] [SERVER-0248] The JEUS server is SHUTDOWN.
[2016.08.24 03:42:36][0] [server1-63] [SERVER-0265] The JEUS server has exited.
[2016.08.24 03:42:36][0] [server1-1] [SERVER-0099] The server[server1] has been
shut down.
[2016.08.24 03:42:36][0] [server1-9] [SERVER-0565] The JVM process is shutting down.
[2016.08.24 03:42:36][0] [server1-9] [SERVER-0566] The JVM process will be terminated.

3.1.4. Suspending a Managed Server

Shutting down an MS involves stopping all application services and shutting down the MS JVM.

A separate function is provided to suspend all applications by applying graceful timeout so that the requests currently being processed can be completed. To suspend applications, use WebAdmin or the suspend-server command in the console tool.

Using WebAdmin

The following are the steps for suspending a server in WebAdmin.

  1. Select [Monitoring] > [Servers] from the left menu of WebAdmin to go to the domain server list screen. Check the box next to the name of the server to suspend and click [suspend].

    [Figure 3.2] Domain Server List

    Domain Server List


  2. The following screenshot shows that the server has been suspended.

    [Figure 3.3] Suspending a Domain Server

    Suspending a Domain Server


Using the Console Tool

The following is an example of suspending a server using the console tool.

[DAS]domain1.adminServer>suspend-server -servers server1 -to 60000
Successfully suspended server(s).

The server-info command can be used to verify that the server has been suspended.

[DAS]domain1.adminServer>server-info

Information of Domain (domain1)
================================================================================
+-------+---------+-----+-----+-----+--------------+-------+-----------+-------+
| Server|  Status |Node | PID | Clu | Latest Start |  Need |   Listen  | Runni |
|       |         |Name |     |ster |    Time /    |  to   |   Ports   |  ng   |
|       |         |     |     |     |Shutdown Time |Restart|           |Engines|
+-------+---------+-----+-----+-----+--------------+-------+-----------+-------+
| admin | RUNNING | nod | 5716| N/A | 2016-08-24   | true  | base-0.0. | jms,  |
|Server |(03:05:3 |e1   |     |     |(Wed) PM      |       |0.0:9736   |ejb,   |
|(*)    |6)       |     |     |     |12:57:36 KST  |       | http-serv |web    |
|       |         |     |     |     |              |       |er-0.0.0.0 |       |
|       |         |     |     |     |              |       |:8088      |       |
|       |         |     |     |     |              |       | jms-0.0.0 |       |
|       |         |     |     |     |              |       |.0:9741    |       |
+-------+---------+-----+-----+-----+--------------+-------+-----------+-------+
| serve | SUSPEND | nod | 139 | clu | 2016-08-24   | false | BASE-0.0. | jms,  |
|r1     |ED(00:00 |e1   |84   |ster1|(Wed) PM      |       |0.0:9836   |ejb,   |
|       |:58)     |     |     |     |04:02:14 KST  |       |           |web    |
+-------+---------+-----+-----+-----+--------------+-------+-----------+-------+
================================================================================

The following message is displayed when a server has been successfully suspended.

[2012.05.12 18:24:51][2] [server1-30] [SERVER-0248] The JEUS server is SUSPENDING.
...
[2012.05.12 18:24:51][2] [server1-30] [EJB-4953] [deployment_helloear#ejb] The EJB 
module stopped.
[2012.05.12 18:24:51][2] [server1-30] [WEB-3485] ServletContext[name=deployment_
helloear#web, path=/hello, ctime=Sat May 12 18:24:15 KST 2012] stopped successfully.
[2012.05.12 18:24:51][2] [server1-30] [SERVER-0248] The JEUS server is SUSPENDED.

Note

Even when a server is not managed by DAS, an MS can be suspended by directly accessing the server through the console tool.

3.1.5. Resuming a Managed Server

It is possible to resume the applications of the suspended server.

Using WebAdmin

The following are the steps for resuming a server in WebAdmin.

  1. Select [Monitoring] > [Servers] from the left menu of WebAdmin to go to server list screen. Check the box next to the name of the server to resume its services and click [resume].

    [Figure 3.4] Domain Server List

    Domain Server List

  2. The following screenshot shows that the server has been resumed successfully.

    [Figure 3.5] Resuming a Domain Server

    Resuming a Domain Server


Using the Console Tool

Even when an MS is not managed by DAS, the suspended MS can be resumed by directly accessing the server through the console tool.

The following is an example of resuming a server using the console tool.

[DAS]domain1.adminServer>resume-server -servers server1
Successfully resumed the servers.

The server-info command can be used to check that the server is in the RUNNING state.

[DAS]domain1.adminServer>server-info

Information of Domain (domain1)
================================================================================
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| Server|  Status |Node | PID | Clu |   Latest   |  Need  |   Listen  |Running |
|       |         |Name |     |ster | Start Time |   to   |   Ports   |Engines |
|       |         |     |     |     | / Shutdown |Restart |           |        |
|       |         |     |     |     |    Time    |        |           |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| admin | RUNNING | nod | 5716| N/A | 2016-08-24 | true   | base-0.0. | jms,   |
|Server |(04:26:5 |e1   |     |     | (Wed) PM   |        |0.0:9736   |ejb, web|
|(*)    |3)       |     |     |     |12:57:36 KST|        | http-serv |        |
|       |         |     |     |     |            |        |er-0.0.0.0 |        |
|       |         |     |     |     |            |        |:8088      |        |
|       |         |     |     |     |            |        | jms-0.0.0 |        |
|       |         |     |     |     |            |        |.0:9741    |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
| serve | RUNNING | nod | 4620| clu | 2016-08-24 | false  | BASE-0.0. | jms,   |
|r1     |(00:01:0 |e1   |     |ster1| (Wed) PM   |        |0.0:9836   |ejb, web|
|       |0)       |     |     |     |05:23:29 KST|        |           |        |
+-------+---------+-----+-----+-----+------------+--------+-----------+--------+
================================================================================

The following message is displayed when the application services of the server have been resumed successfully.

[2012.05.12 18:25:07][2] [server1-30] [SERVER-0248] The JEUS server is RESUMING.
[2012.05.12 18:25:07][2] [server1-30] [Deploy-0098] Starting the application
[deployment_helloear].
[2012.05.12 18:25:07][2] [server1-30] [EJB-4952] [deployment_helloear#ejb] 
The EJB module started.
[2012.05.12 18:25:07][2] [server1-30] [WEB-3484] ServletContext[name=deployment_
helloear#web, path=/hello, ctime=Sat May 12 18:24:15 KST 2012] started 
successfully.
[2012.05.12 18:25:07][2] [server1-30] [Deploy-0099] Successfully started the 
application[deployment_helloear].
[2012.05.12 18:25:07][2] [server1-30] [SERVER-0248] The JEUS server is RUNNING.

3.2. Server Engine Configuration

Internally, JEUS has engines that run applications. There are separate engines for web application services, EJB application services, and JMS services. Option to use each engine can be configured during initialization, but the server must be restarted in order to apply the configuration.

3.2.1. Option to Use an Engine

The option to use each engine can be configured on the JEUS server. When an engine is configured for use, it is initialized either when the server boots or when the first application that needs the engine is deployed. If an engine is not configured for use, it does not get initialized even after the server starts, and application deployment to the engine will fail.

Warning

Previously deployed applications will fail to be deployed if the server is restarted after setting the engine for non-use. The server state also changes to STANDBY instead of RUNNING. The administrator must manually change the engine and the application states.

Option to use an engine can be configured by using WebAdmin or the console tool.

Using WebAdmin

Select a server from [Servers] in the left menu of WebAdmin to display the server configuration. Option to use each engine appears in the middle of the screen.

[Figure 3.6] Internal Server Engine Configuration

Internal Server Engine Configuration

After clicking [Lock & Edit], configure the engine and click [OK]. Click [Apply Changes] to apply the changes and restart the server.

[Figure 3.7] Result of Configuring Server Engines

Result of Configuring Server Engines

Using the Console Tool

The following example shows how to configure each engine on the server by using the console tool.

[DAS]domain1.adminServer>disable-engines adminServer -all
All engine(s) was(were) successfully disabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully changed only the XML.                                           |
| Restart the server to apply the changes.                                     |
+------------------------------------------------------------------------------+
================================================================================
...
[DAS]domain1.adminServer>disable-engines adminServer -web -ejb
Web EJB engine(s) was(were) successfully disabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully changed only the XML.                                           |
| Restart the server to apply the changes.                                     |
+------------------------------------------------------------------------------+
================================================================================
...

[DAS]domain1.adminServer>disable-engines adminServer -all
All engine(s) was(were) successfully enabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully applied part of the changes.                                    |
| Restart the server to apply the remaining changes.                           |
+------------------------------------------------------------------------------+
================================================================================
...
[DAS]domain1.adminServer>disable-engines adminServer -web -ejb
Web EJB engine(s) was(were) successfully enabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully applied part of the changes.                                    |
| Restart the server to apply the remaining changes.                           |
+------------------------------------------------------------------------------+
================================================================================

Note

For more information about server engine configuration commands, refer to JEUS Reference Book. "4.2.3.9. disable-engines",JEUS Reference Book. "4.2.3.15. enable-engines".

3.2.2. Engine Initialization Time Configuration

Each engine of JEUS can be configured for use. When an engine is configured for use, it is initialized either when the server boots or when the first application that needs the engine is deployed. If an engine is not configured for use, it does not get initialized even after the server starts, and application deployment to the engine will fail.

Option to initialize an engine can be configured by using WebAdmin or the console tool.

Using WebAdmin

Select a server from [Servers] in the left menu of WebAdmin to display the server configuration. Option to initialize each engine appears in the middle of the screen.

After clicking [Lock & Edit], configure the engine and click [OK]. Click [Apply Changes] to apply the changes, and restart the server. The screen is the same as that for configuring the option to use an engine. Refer to the previous screen.

Using the Console Tool

The following example shows how to initialize each engine on the server by using the console tool.

[DAS]domain1.adminServer>disable-engine-init-on-boot adminServer,server1
EngineInitOnBoot was successfully enabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully changed only the XML.                                           |
| Restart the server to apply the changes.                                     |
+------------------------------------------------------------------------------+
================================================================================

[DAS]domain1.adminServer>enable-engine-init-on-boot adminServer
EngineInitOnBoot was successfully enabled.
The configuration was changed.
================================================================================
+------------------------------------------------------------------------------+
|                                    Result                                    |
+------------------------------------------------------------------------------+
| Successfully applied part of the changes.                                    |
| Restart the server to apply the remaining changes.                           |
+------------------------------------------------------------------------------+
================================================================================

Note

For more information about server engine configuration commands, refer to JEUS Reference Book. "4.2.3.8. disable-engine-init-on-boot", and JEUS Reference Book. "4.2.3.14. enable-engine-init-on-boot".

3.3. Controlling and Monitoring Threads

JEUS provides functions to monitor servlet and EJB remote threads, and system pools. JEUS also provides a function that checks thread stacks as well as sends interrupt signals to specific threads.

3.3.1. Thread Monitoring

JEUS provides a function to monitor threads including servlet request threads, EJB remote request threads, and system thread pools.

By using the function to monitor servlet threads or EJB remote request threads, it is possible to check the thread ID, thread name, thread status, and processing time. Using the thread pool monitoring function makes it possible to know the core size, max size, and keep alive time of the system thread pool as well as the information about the threads in the system thread pool.

Note

Note that only the servlet threads and EJB remote request threads can be monitored in the console tool.

Thread Information Check

Thread information can be checked by using WebAdmin or the console tool.

  • Using WebAdmin

    Select [Monitoring] > [Threads] from the left menu of WebAdmin to go to the thread monitoring screen.

    [Figure 3.8] Thread Monitoring Screen

    Thread Monitoring Screen

    Select the name of the server to check its thread information as shown in the following screenshot.

    [Figure 3.9] Checking Thread Information in WebAdmin

    Checking Thread Information in WebAdmin

  • Using the Console Tool

    The following shows how to check thread information using the console tool.

    [DAS]domain1.adminServer>thread-info -server adminServer
    
    Thread information for the server [adminServer]
    There are no EJB RMI threads for the server [adminServer].
    ============================================================
    The web container threads for 'ADMIN-HTTP' listener.
    
    +-----+--------------------------+---------+---------+-----+
    | tid |           name           |  state  | elapsed | uri |
    +-----+--------------------------+---------+---------+-----+
    |  48 | ADMIN-HTTP-2             | waiting |   21050 |     |
    +-----+--------------------------+---------+---------+-----+
    
    elapsed: Elapsed time (ms)
    ============================================================
    
    ================================================================================
    Thread statistics for the 'ADMIN-HTTP' listener.
    
    +-----------------------------------+-------+--------+------+---------+--------+
    |                                   | total | active | idle | blocked | reconn |
    +-----------------------------------+-------+--------+------+---------+--------+
    | The number of threads.            |     1 |      0 |    1 |       0 |      0 |
    +-----------------------------------+-------+--------+------+---------+--------+
    
    total = active + idle, reconn: reconnecting
    ================================================================================
    
    ======================================================
    The web container threads for 'http1' listener.
    
    +-----+--------------------+---------+---------+-----+
    
    [DAS]domain1.adminServer>disable-engines adminServer -all
    All engine(s) was(were) successfully disabled.
    The configuration was changed.
    ================================================================================
    +------------------------------------------------------------------------------+
    |                                    Result                                    |
    +------------------------------------------------------------------------------+
    | Successfully changed only the XML.                                           |
    | Restart the server to apply the changes.                                     |
    +------------------------------------------------------------------------------+
    ================================================================================
    
    [DAS]domain1.adminServer>thread-info -server adminServer
    
    Thread information for the server [adminServer]
    There are no EJB RMI threads for the server [adminServer].
    
    ============================================================
    The web container threads for 'ADMIN-HTTP' listener.
    
    +------+-------------------------+---------+---------+-----+
    |  tid |           name          |  state  | elapsed | uri |
    +------+-------------------------+---------+---------+-----+
    | 1053 | ADMIN-HTTP-14           | waiting |  123437 |     |
    | 1077 | ADMIN-HTTP-16           | waiting |  107897 |     |
    | 1078 | ADMIN-HTTP-17           | waiting |  123464 |     |
    +------+-------------------------+---------+---------+-----+
    
    elapsed: Elapsed time (ms)
    ============================================================
    
    ================================================================================
    Thread statistics for the 'ADMIN-HTTP' listener.
    
    +-----------------------------------+-------+--------+------+---------+--------+
    |                                   | total | active | idle | blocked | reconn |
    +-----------------------------------+-------+--------+------+---------+--------+
    | The number of threads.            |     3 |      0 |    3 |       0 |      0 |
    +-----------------------------------+-------+--------+------+---------+--------+
    
    total = active + idle, reconn: reconnecting
    ================================================================================
    
    =============================================================
    The web container threads for 'http1' listener.
    
    +-----+------------------+---------+------------------+-----+
    | tid |       name       |  state  |      elapsed     | uri |
    +-----+------------------+---------+------------------+-----+
    |  49 | http1-1          | waiting |         16083595 |     |
    |  58 | http1-10         | waiting |         16083594 |     |
    |  50 | http1-2          | waiting |         16083595 |     |
    |  51 | http1-3          | waiting |         16083595 |     |
    |  52 | http1-4          | waiting |         16083595 |     |
    |  53 | http1-5          | waiting |         16083594 |     |
    |  54 | http1-6          | waiting |         16083594 |     |
    |  55 | http1-7          | waiting |         16083594 |     |
    |  56 | http1-8          | waiting |         16083594 |     |
    |  57 | http1-9          | waiting |         16083594 |     |
    +-----+------------------+---------+------------------+-----+
    
    elapsed: Elapsed time (ms)
    =============================================================
    
    ================================================================================
    Thread statistics for the 'http1' listener.
    
    +-----------------------------------+-------+--------+------+---------+--------+
    |                                   | total | active | idle | blocked | reconn |
    +-----------------------------------+-------+--------+------+---------+--------+
    | The number of threads.            |    10 |      0 |   10 |       0 |      0 |
    +-----------------------------------+-------+--------+------+---------+--------+
    
    total = active + idle, reconn: reconnecting
    ================================================================================
    
    ================================================================================
    The threads for the 'threadpool.System' thread pool.
    
    +-----+----------------------------------------+---------------+---------------+
    | tid |                  name                  |  thread state | active thread |
    +-----+----------------------------------------+---------------+---------------+
    | 683 | threadpool.System-4 [adminServer-683]  | RUNNABLE      | true          |
    |  71 | threadpool.System-2 [adminServer-71]   | TIMED_WAITING | false         |
    | 124 | threadpool.System-3 [adminServer-124]  | TIMED_WAITING | false         |
    |  68 | threadpool.System-1 [adminServer-68]   | TIMED_WAITING | false         |
    +-----+----------------------------------------+---------------+---------------+
    ================================================================================
    
    ================================================================================
    The statistics for the 'threadpool.System' thread pool.
    
    +-----------+-----------+-----------+-----------+----------+-------------------+
    | pool name |  minimum  |  maximum  |  current  |   work   |   remaining work  |
    |           | pool size | pool size | pool size |queue size|    queue size     |
    +-----------+-----------+-----------+-----------+----------+-------------------+
    | threadpoo |         0 |       100 |         4 |     4096 |              4096 |
    |l.System   |           |           |           |          |                   |
    +-----------+-----------+-----------+-----------+----------+-------------------+
    ================================================================================

Checking the Stack Trace of a Thread

It is possible to check the stack trace of a certain thread by using WebAdmin or the console tool.

  • Using WebAdmin

    Select a tid from the thread monitoring screen of WebAdmin to view the stack trace of the selected thread as shown in the following screenshot.

    [Figure 3.10] Checking a Thread Stack Trace in WebAdmin

    Checking a Thread Stack Trace in WebAdmin


  • Using the Console Tool

    The stack trace of a desired thread can also be checked in the console tool. The thread stack trace is usually checked when a blocked thread is detected by using the tid command of the console tool.

    [DAS]domain1.adminServer>print-stack-trace -server server1 45
    servlet thread [tid=45] Stack trace of ADMIN-HTTP-1 [server1-45] tid=45
    java.lang.Thread.State: WAITING
      at sun.misc.Unsafe.park(Native Method)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:156)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
    .await(AbstractQueuedSynchronizer.java:1987)
      at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
      at jeus.util.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1291)
      at jeus.servlet.engine.WebThreadPoolExecutor.getTask(WebThreadPoolExecutor.java:68)
      at jeus.util.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:1215)
      at jeus.servlet.engine.WebThreadPoolExecutor$WebRequestWorker.
    run(WebThreadPoolExecutor.java:332)
      at java.lang.Thread.run(Thread.java:662)

Note

1. For more information about the ti and strace commands of the JEUS console tool, refer to JEUS Reference Book. "4.2.2. Local Commands".

2. Information about servlet threads, EJB remote request threads, and stack trace can be checked in [Monitoring] > [Threads] of WebAdmin. Information about the system thread pool and its threads can also be checked.

For more information, refer to"JEUS WebAdmin User Guide" and online help.

3.3.2. Thread Control

JEUS provides a function that sends an InterruptSignal to a specific thread to trigger an exception to stop the thread execution.

Caution

This function is provided experimentally. If a thread is interrupted, the thread will not be stopped right away. Instead, it checks the interrupt status and throws an exception to stop any further processing. The exception must be handled in the user application, and the user assumes responsibility for issues that occur from unhandled exceptions.

Thread Interrupt

Interrupting a thread means sending a signal to induce an exception to stop further processing of the thread. It is usually used when a request is blocked or delayed longer than expected.

When a thread is interrupted, the thread is neither forcibly stopped nor stopped immediately.

JEUS supports a function that can send the InterruptSignal to a servlet thread, EJB remote request thread, and running thread in the system thread pool. A thread can be interrupted if it is processing a JNDI remote connection, EJB, JDBC, or IO operation.

  • Servlet Thread

    An exception is thrown when a servlet thread is interrupted in the following cases. The exception must be handled in the user application.

    • When connecting to a remote JNDI

    • When processing a JNDI remote operation

    • When calling an EJB

    • When getting a JDBC connection or calling a method of the connected object.

    An interrupt signal can be issued directly through the console tool or WebAdmin, or through a function that checks the processing time of a servlet thread. To configure this function, refer to JEUS Web Engine Guide. "2.3.7. Automatic Thread Pool Management (Thread State Notification)".

  • EJB Remote Request Thread

    An EJB issues a javax.ejb.EJBException by checking the interrupt status in the following cases.

    • When an EJBHome method like 'create' is called in the EJB 2.x way (in EJB 3.0, create is processed internally in the EJB container when the user looks up an EJB).

    • When calling an EJB business method

    The exception must be handled in the user application. If the interrupt signal is issued after the EJB business method is called, an exception may not occur. However, the thread may be interrupted when the method calls another EJB or uses a JDBC or JNDI operation.

  • JDBC

    For JDBC operations, if an interrupt signal is received while executing the following operations, a java.sql.SQLException will occur. The user application must handle the exception.

    • When getting a connection from the connection pool via DataSource#getConnection().

    • When using the java.sql.Connection from the connection pool.

    • When using the executeQuery operation after setting the use-sql-trace or stmt-caching-size option for the JDBC connection pool. (For more information about the options, refer to "6.4.2. Connection Pool Configuration")

  • JNDI

    A JNDI operation can sometimes be interrupted. If the interrupt signal is issued while executing the following JNDI operations, a javax.naming.NamingException will occur. The user application must handle the exception.

    • When connecting to a remote JNDI (when a javax.naming.InitialContext is created).

    • When a remote message is sent while executing a JNDI operation.

      The operation can be interrupted during JNDI operations such as looking up, binding, rebinding, and renaming, but not when accessing a local registry or cache.

  • IO Operation

    The IO operation can sometimes be interrupted depending on the situation.

    • java.nio.channels.SocketChannel

      An operation can be interrupted while using the java.nio.channels.SocketChannel. Connecting via the java.nio.channels.SocketChannel is performed in three steps.

      In the begin step, check whether the interrupt status of the thread is set, and close the channel if it is set. During the actual connection step, if the Interrupt Status is set, the connect() method is not called. During the end step, a java.nio.channels.ClosedByInterruptedException occurs if the Interrupt Status is set (Interrupt Status gets cleared afterwards).

    • java.nio.channels.SocketChannel#read()/java.nio.channels.SocketChannel#write()

      The java.nio.channels.SocketChannel#read() or java.nio.channels.SocketChannel#write() is performed in three steps.

      In the begin step, check whether the interrupt status of the thread is set, and close the channel if it is set. In the second step, if the interrupt status is set, read or write operation is not executed. During the end step, a java.nio.channels.ClosedByInterruptedException occurs if the Interrupt Status is set (Interrupt Status gets cleared afterwards).

      After the java.nio.channels.ClosedByInterruptedException has been thrown, if a read or write is attempted by using the previously created channel a java.nio.channels.ClosedChannelException is thrown.

    • Using java.net.Socket

      When using the java.net.Socket, the Socket IO operation can be interrupted depending on the JVM compile options in HP-UX and Solaris.

      A read or write operation that uses a socket stream can be interrupted and a java.net.SocketException is thrown. (Interrupt Status gets cleared afterwards). This does not immediately close the socket, but it stops any subsequent operations.

      A thread that is executing a socket IO operation is not interrupted in Windows, IBM AIX, and LINUX.

  • Object#wait() / Thread#sleep() /Thread#join()

    When a thread that is executing Object#wait(), Thread#sleep(), or Thread#join() can be interrupted by throwing a java.lang.InterruptedException. (Interrupt Status gets cleared afterwards).

Note

Refer to the Javadoc API of each class.

Sending the Interrupt Signal

JEUS provides a command to send an interrupt signal to a thread by using the console tool or WebAdmin.

  • Using WebAdmin

    The interrupt signal can be sent to a desired thread by clicking [interrupt] from the thread monitoring screen.

  • Using the Console Tool

    The following is an example of sending the thread interrupt signal by using the console tool. For more information about the interrupt-thread command in the JEUS console tool, refer to JEUS Reference Book. "4.2.5.1. interrupt-thread".

    [DAS]domain1.adminServer>interrupt-thread -server server1 45
    Sent an interrupt hint signal to the thread [tid=45] on the server server1.

3.4. Memory Monitoring and Control

JEUS monitors the memory usage and controls the server when it exceeds the specified free memory.

3.4.1. Memory Monitoring

Memory information can be checked in WebAdmin or the console tool.

Using WebAdmin

The following describes how to check the memory information in WebAdmin.

Note

To check memory information in WebAdmin, use the [Web] menu under the [Monitoring] menu, or use the [System Information] menu. Besides the memory information, the CPU, process, and JVM information can also be checked in the [System Information] menu. This section uses the [System Information] menu as an example.

  1. Select [Monitoring] > [System Information] from the left menu in WebAdmin to go to the system information monitoring screen.

    [Figure 3.11] System Information Monitoring Screen

    System Information Monitoring Screen

  2. Click a server name to check its memory information as shown in the following screenshot.

    [Figure 3.12] Checking Memory Information in WebAdmin

    Checking Memory Information in WebAdmin


Using the Console Tool

Memory information can also be checked by using the memory-info command in the console tool. For more information about the memory-info command, refer to JEUS Reference Book. "4.2.3. Server Management Commands".

[DAS]domain1.adminServer>memory-info -servers adminServer
Domain [domain1] Memory Information
Memory Information
================================================================================
+-------------+---------------------------+------------------------------------+
|    Server   |   Total Amount of Memory  |    The Current Amount of Memory    |
+-------------+---------------------------+------------------------------------+
| adminServer |                 177274880 |                          101567168 |
+-------------+---------------------------+------------------------------------+
================================================================================

3.4.2. Memory Usage Control

Since this function is not commonly used in JEUS, memory related operations can only be controlled through the current system properties.

Note

1. When a memory overflow occurs, a heap dump is executed only once (created in the 'SERVER_HOME/logs' directory).

2. For IBM JDK, a heap dump is created in the directory where Java is running. In order to configure a different path, use the '-Xdump:heap:file' option. For information about other IBM heap dump options, refer to the relevant website.

3. A thread dump is written in log before a heap dump is created.

The following are the properties related to memory usage control.

PropertyDescription
jeus.server.memorymonitor.enabled

Configures whether to use MemoryMoniterService. If the configuration is not enabled, then the rest of the properties do not have any meaning.

(Default value: false)

jeus.server.memorymonitor.ratioConfigures the memory overflow standard. If 0.8 is configured, then if 80% of memory is used (based on the max memory), then it shall be considered as overflow.
jeus.server.memorymonitor.interval

Configures the cycle which measures memory usage.

(Default Value: 2000, unit: ms)

jeus.server.memorymonitor.duration

Configures the time which determines memory overflow. (Default value: 60000, Unit: ms)

For example, if jeus.server.memorymonitor.ratio is 0.8 and jeus.server.memorymonitor.duration is 1 minute, then in MemoryMonitorService, when over 80% of memory is continued for over 1 minute, then it is considered as memory overflow.

jeus.server.enable.restart.in.memory.shortageWhen determined as memory overflow, then determines whether the server will be automatically restarted. (Default value: true).