This topic applies to messaging engines that are configured
to use a data store. If a messaging engine cannot connect to its data
store, for example because the database that contains the data store
is not running, it fails to start. You can tune your system to increase
the chance of a successful start of the messaging engine.
About this task
In a single-server environment, when you start the application
server the messaging engine attempts to start. If the database is
unavailable, the messaging engine might enter the stopped state and
need to be started manually.
When the messaging
engine attempts to connect to the data store, it tries to connect
for 15 minutes by default, before failing to start.
You can
increase the chance of the messaging engine starting successfully
by configuring various parameters on the database server or application
server.
Procedure
- On the database server, configure the operating system
to minimize the amount of time taken to detect the loss of a network
connection to an application server. Refer to the documentation
for the operating system for details. For example, the following table
lists the relevant parameters for Windows® and AIX® operating systems:
Table 1. TCP/IP
parameters
Parameter name on Windows operating systems |
Parameter name on AIX operating systems |
Description |
KeepAliveTime |
tcp_keepidle |
The amount of time (in milliseconds on Windows operating systems and
in 0.5 seconds on AIX operating
systems) to wait before sending a keepalive request
for an inactive connection. |
KeepAliveInterval |
tcp_keepintvl |
The amount of time (in milliseconds on Windows operating systems and
in 0.5 seconds on AIX operating
systems) to wait for a response. |
TCPMaxDataRetransmissions |
tcp_keepcnt |
The number of requests to send before ending
the connection. |
You can calculate the total amount of time taken for the database
server to detect the failure of the connection to the application
server, by using the following formula:time to detect connection failure = keep alive time + (keep alive interval x number of requests)
For example, for a Windows system
with the parameters set according to the following table, the total
amount of time taken for the database server to detect the failure
of the connection to the application server is 350 seconds.
Table 2. Example parameter values
Parameter |
Value |
KeepAlive |
300000 milliseconds |
KeepAliveInterval |
10000 milliseconds |
TCPMaxDataRetransmissions |
5 |
Your database product might also have relevant parameters
that you can configure, for example, the IDLE THREAD TIMEOUT parameter
in DB2® for z/OS®. When the database
server detects the loss of the connection to the application server,
the database releases the locks on the data store. The messaging engine
can now access the data store and can therefore start successfully.
On the application server,
tune the messaging engine to wait for an appropriate amount of time
for the data store to become available. By default, the
messaging engine will attempt to connect to the data store every 2
seconds for 15 minutes. Complete the rest of this step if you want
to adjust these timings.
- Click bus_name to navigate to the custom properties
panel for the messaging engine.
- Click New.
- Type sib.msgstore.jdbcInitialDatasourceWaitTimeout in
the Name field and an appropriate value in the Value field. This
property is the time, in milliseconds, to wait for the data store
to become available. The default value is 900000 (15 minutes). This
time includes the time required to establish a connection to the database
and to obtain the required table locks.
Ensure that the value of
this property is greater than the total time taken for the database
server to detect the loss of a network connection, as configured in
step 1.
- Click OK.
- Click New.
- Type sib.msgstore.jdbcStaleConnectionRetryDelay in
the Name field and an appropriate value in the Value field. This
property is the time, in milliseconds, to wait between attempts to
connect to the data store. The default value is 2000 (2 seconds).
For example, if you set the sib.msgstore.jdbcInitialDatasourceWaitTimeout
property to 600000, and the sib.msgstore.jdbcStaleConnectionRetryDelay
property to 3000, the messaging engine will attempt to connect every
3 seconds until 10 minutes has passed.
- Click OK.
- Save your changes to the master configuration.
- Restart the application server.
Results
By configuring these parameters and custom properties, you
minimize the amount of time taken for the database server to detect
the loss of a network connection, and ensure that the messaging engine
waits for a reasonable amount of time for the database connection
to recover before attempting to start.
What to do next
You might want to configure
the messaging engine and server to restart in the event of a database
connection failure. This behavior reduces the risk of the messaging
engine being in an inconsistent state when the database connection
is restored.