Chapter 2. Configuring a Batch Thread Pool

Table of Contents

2.1. Overview
2.2. Configuring Batch Thread Pools
2.2.1. Configuring Thread Pools in Component DD
2.2.2. Configuring Thread Pools in Application DD
2.3. Thread Pool Logging

This chapter describes configuration for a thread pool that execute a job defined in JBatch.

2.1. Overview

A thread pool can be configured in the Web (or EJB), or in the application whose batch-thread-pool option contains thread pool specifications and allows threads to be used regardless of priority.

Note

If thread pools are configured in both Web DD and application DD, or in both EJB DD and application DD, they follow the configuration in either Web DD or EJB DD.

2.2. Configuring Batch Thread Pools

If batch-thread-pool is not specified in DD, the server uses the default thread pool to execute a job.

The following describes the thread pool settings.

ItemDescription
min

Minimum number of threads for a thread pool to execute a job.

(Default: 0)

max

Maximum number of threads for a thread pool to execute a job.

(Default: 0)

keep-alive-time

Amount of time after which idle threads are discarded when the number of threads are between the values set for min and max.

No thread is discarded if there is none in the thread pool. (Default: 60,000; Unit: ms)

queue-size

Size of the queue of pending requests defined in the thread pool.

(Default: 4096)

Tuning the thread pool depends on the priority of each DD statement. This section describes each DD configuration.

2.2.1. Configuring Thread Pools in Component DD

A component refers to any one of JBatch components such as a servlet or an EJB, and it has the highest priority in case there are many thread pool configurations in the server. The thread pool can be configured in jeus-web-dd.xml or jeus-ejb-dd.xml.

The following is an example of configuring batch-thread-pool in /WEB-INF/jeus-web-dd.xml.

[Example 2.1] Configuring Thread Pools in Component DD: <<jeus-web-dd.xml>>

<jeus-web-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="8.0">
    <batch-thread-pool>
        <min>10</min>
        <max>20</max>
        <keep-alive-time>20</keep-alive-time>
        <queue-size>4096</queue-size>
    </batch-thread-pool>
</jeus-web-dd>

The following is an example of configuring batch-thread-pool in /META-INF/jeus-ejb-dd.xml.

[Example 2.2] Configuring Thread Pools in Component DD: <<jeus-ejb-dd.xml>>

<jeus-ejb-dd xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="8.0">
    <batch-thread-pool>
        <min>10</min>
        <max>20</max>
        <keep-alive-time>20</keep-alive-time>
        <queue-size>4096</queue-size>
    </batch-thread-pool>
</jeus-ejb-dd>

2.2.2. Configuring Thread Pools in Application DD

The following is an example of configuring batch-thread-pool in /META-INF/jeus-application-dd.xml.

[Example 2.3] Configuring Thread Pools in Application DD: <<jeus-application-dd.xml>>

<application xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="8.0">
    <batch-thread-pool>
        <min>10</min>
        <max>20</max>
        <keep-alive-time>20</keep-alive-time>
        <queue-size>4096</queue-size>
    </batch-thread-pool>
</application>

2.3. Thread Pool Logging

JBatch does not use the JEUS logger but a Java logger, which needs configuration. For information about configuring a Java logger, see JEUS Server Guide. "8.3. Logging Configuration".

Note

The level of the logger should be configured according to the com.ibm.jbatch.