SwiftMQ Documentation

SwiftMQ Documentation

  • Client
  • CE
  • UR
  • HA
  • Javadocs
  • Release Notes

›Swiftlets

SwiftMQ Client

  • Getting Started
  • JNDI Client
  • JMS Client
  • AMQP 1.0 Client
  • Filetransfer Client

SwiftMQ CE

  • Getting Started
  • Installation
  • Upgrade
  • Software Architecture
  • Administration

    • Preconfig
    • CLI Command Line Interface
    • JMX Administration
    • CLI Message Interface
    • routerconfig.xml Watch Dog
    • System Properties

    Swiftlets

    • AMQP Swiftlet
    • Authentication Swiftlet
    • Deploy Swiftlet
    • JMS Swiftlet
    • JNDI Swiftlet
    • Log Swiftlet
    • Management Swiftlet
    • MQTT Swiftlet
    • Network Swiftlet
    • Queue Manager Swiftlet
    • Routing Swiftlet
    • Scheduler Swiftlet
    • Store Swiftlet
    • Streams Swiftlet
    • Threadpool Swiftlet
    • Timer Swiftlet
    • Topic Manager Swiftlet
    • Trace Swiftlet
    • XA Resource Manager Swiftlet

    APIs

    • CLI Admin API

    How To

    • TLS Configuration
    • HTTP Tunneling Configuration
    • Upgrade SwiftMQ Router and Clients

    In Depth

    • Versioning
    • File Store

SwiftMQ UR

  • Getting Started
  • License
  • Installation
  • Upgrade
  • Administration

    • SwiftMQ Explorer

    Swiftlets

    • JDBC Authentication Swiftlet
    • FileCache Swiftlet
    • JMS Application Container Swiftlet
    • JMS XA Swiftlet
    • JDBC Store Swiftlet
    • AMQP Bridge Extension Swiftlet
    • JMS Bridge Extension Swiftlet
    • JavaMail Bridge Extension Swiftlet
    • Replicator Extension Swiftlet

SwiftMQ HA

  • Getting Started
  • License
  • Installation
  • Upgrade
  • HA Introduction
  • HA Deployment
  • Administration
  • JNDI/JMS under HA
  • Routing under HA
  • Advanced Configuration
  • HA Test Suite

Threadpool Swiftlet

Introduction

SwiftMQ's entire design is non-blocking. All tasks performed by other Swiftlets are dispatched to thread pools and are performed asynchronously.

All thread pools are managed by the Threadpool Swiftlet. A thread pool consists of a pool queue which is a fast ring buffer and threads to execute dispatched tasks.

Tuning

Minimum Threads

If a thread pool is created, the number of threads is pre-created and will never die. One should always have "some" minimum threads per pool if that pool is often frequented, such as JMS pools. An adequate minimum thread setting will prevent that threads will die after the idle timeout and thus must be recreated if a new task instance is dispatched to the pool. One should not specify too many threads to keep the resource consumption low. The best way is to watch the "Usage" entity table of the Threadpool Swiftlet from the SwiftMQ Explorer to the average usage per pool. This is a good value for the minimum thread setting.

Maximum Threads

This setting avoids resource exhaustion and is also used to guarantee that, in some pools, only 1 thread will be executed at all. E.g. the Log Manager of the Store Swiftlet uses his own pool and there should never be more than 1 thread running within that pool. Therefore, one should never change this setting if it is specified within the default configuration.

Queue Length Threshold and Additional Threads

These two attributes specify the pool growing policy. During each dispatch of a task to a pool, it is checked whether the pool is out of threads. This is the case if no idle thread is available. Normally, if a pool is configured with a minimum size of threads, these threads handle the load. At peaks, if more tasks are dispatched, the pool's queue grows up. By specifying a queue length threshold, one can define how large the pool's queue may grow until additional threads are started. Per default, both attributes have a value of 1, that is, if no idle thread is available during a task dispatch, 1 additional thread will be started. E.g. to handle peak loads, one can specify that 5 additional threads should be started if the queue length reaches 10. If the queue length is below 10, no additional threads are started and the tasks are waiting until a thread becomes available.

Idle Timeout

The idle timeout specifies the time in milliseconds after which a thread will die in the case that it is idle. If this value is too low, threads might die too early and you will get into the re-creation problem. If it is too high, threads might be idle too long and you may consume too much threads. So it really depends on the interval in which tasks are dispatched to the pool. The default idle timeout is 120000 milliseconds and should fit most requirements.

Priority

This setting specifies the thread priority of this pool. We have never seen that this has an effect at all concerning the processing behaviour. The default is normal priority (5).

Configuration

The configuration of the Threadpool Swiftlet is defined within the element

      <swiftlet name="sys$threadpool" .../>

of the router's configuration file. One can use the SwiftMQ Exlorer or CLI for configuration as well. They both save into that file.

Attributes of Element "swiftlet"

Definition

Attribute Type Mandatory Description
collect-interval java.lang.Long No Interval for collecting the Thread Counts per Pool

Values

Attribute Values
collect-interval Default: 1000

Element List "pools", Parent Element: "swiftlet"

Threadpool Definitions. This element list contains zero or more "pool" elements with this template definition:

Definition

Attribute Type Mandatory Description
name java.lang.String Yes Name of this Pool
kernel-pool java.lang.Boolean No Marked as a Kernel Pool or not
min-threads java.lang.Integer No Minimum Threads in this Pool
max-threads java.lang.Integer No Maximum Threads in this Pool
queue-length-threshold java.lang.Integer No Starts new Threads when the Queue Length reaches this Threshold
additional-threads java.lang.Integer No Number Threads to Startup after reaching Threshold
priority java.lang.Integer No Priority for Threads in this Pool
idle-timeout java.lang.Long No Timeout for idling Threads in this Pool

Values

Attribute Values
kernel-pool Default: false
min-threads Min: 0
Default: 0
max-threads Default: -1
queue-length-threshold Min: 1
Default: 1
additional-threads Min: 1
Default: 1
priority Min: 1
Max: 10
Default: 5
idle-timeout Default: 120000

Element List "threads", Parent Element: "pool"

Thread Assignment Definitions. This element list contains zero or more "thread" elements with this template definition:

Definition

Attribute Type Mandatory Description
name java.lang.String Yes Name of this Thread

Element List "usage", Parent Element: "swiftlet"

Active Threadpools. This element list contains zero or more "usage" elements with this template definition:

Definition

Attribute Type Mandatory Description
name java.lang.String Yes Name of this Thread Pool
running-threads java.lang.Integer No Running Threads in this Pool
idling-threads java.lang.Integer No Idling Threads in this Pool

Values

Attribute Values
running-threads Default: 0
idling-threads Default: 0
← Streams SwiftletTimer Swiftlet →
  • Introduction
  • Tuning
    • Minimum Threads
    • Maximum Threads
    • Queue Length Threshold and Additional Threads
    • Idle Timeout
    • Priority
  • Configuration
Copyright © 2020 IIT Software GmbH