This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Configuring nhttp.properties

The <ESB_HOME>/repository/conf/nhttp.properties file contains tuning parameters related to HTTP-NIO Transport. These parameters can be modified as required based on your production environment. This information is provided as a reference for users who are already familiar with the product features and want to know how to configure them.

Parameters used by non-blocking HTTP-NIO transport

Parameter NameDescriptionDefault Value
http.socket.timeout

Maximum period of inactivity between two consecutive data packets. Given in milliseconds. This parameter is also defined as SO_TIMEOUT.

60000
http.socket.timeout.receiver

Maximum period of inactivity between two consecutive data packets for the transport listener side. This is the socket timeout value for connection between the client and the ESB server. The value is given in milliseconds.

60000
http.socket.timeout.sender
Maximum period of inactivity between two consecutive data packets for the transport sender side. This is the socket timeout value for connection between the ESB server and the backend server. The value is given in milliseconds.60000
nhttp_buffer_sizeThe size of the buffer through which data passes when receiving/transmitting NHTTP requests. This is given in bytes.8192
http.tcp.nodelayThis determines whether Nagle's algorithm (for improving the efficiency of TCP/IP by reducing the number of packets sent over the network) is used. Value 0 is used to enable this algorithm and value 1 is used to disable it. The algorithm should be enabled if you need to reduce bandwidth consumption.1
http.connection.stalecheckThis determines whether stale connection check is used. Value 0 is used to enable stale connection check and value 1 is used to disable it. When this parameter is enabled, connections which are no longer used will be identified and disabled before each request execution. Stale connection check should be disabled when performing critical operations.0

Properties for AIX based deployment

Parameter NameDescriptionDefault Value
http.nio.interest-ops-queueingDetermines whether interestOps() queueing is enabled for the I/O reactors.true

 

HTTP Sender (Client Worker) thread pool parameters

The following parameters relate to worker thread pools that are used to process responses in non-blocking HTTP transport:

Parameter NameDescriptionDefault Value
lst_t_core

Initial number of threads in the response processing worker (Client Worker) pool.

If the number of live threads is less than the value defined here, a new thread is created to process the response.

20
lst_t_max

Maximum number of threads in the response processing worker (Client Worker) pool.

If the queue (lst_qlen) is full and the number of live threads is less that the value defined here, a new thread will be created to process the response.

100
lst_alive_sec

The keep-alive time in seconds for idle threads in the response processing worker pool. Once this time has elapsed for an idle thread, it will be destroyed.

The purpose of this parameter is to optimize the usage of resources by avoiding wastage that results from having idle threads.

5
lst_qlen

The length of the queue that is used to hold runnable tasks to be executed by the response processing worker pool.

If the number of live threads is equal to the core pool size (lst_t_core) and all threads are busy, new responses will be pushed into the queue so that they can be processed when a thread becomes available.

If you need new threads to be created beyond the core pool size (lst_t_core), ensure you change the default value of this parameter so that it becomes a bounded queue

If the queue is full, all threads are busy and the number of live threads is equal to the max pool size (lst_t_max), new responses will be rejected by the response processing worker.

-1
lst_io_threadsSender-side IO workers.2

When there is an increased load, it is recommended to increase the number of threads mentioned in the parameters above to balance it.

HTTP Listener thread pool parameters

The following parameters relate to worker thread pools that are used to process requests in non-blocking HTTP transport:

Listener-side parameters should generally have the same values as the sender-side parameters.

Parameter NameDescriptionDefault Value
snd_t_core

Initial number of threads in the worker thread pool.

If the number of live threads is less than the value defined here, a new thread is created to process the request.

20
snd_t_max

Maximum number of threads in the request processing worker (Server Worker) pool.

If the queue (snd_qlen) is full and the number of live threads is less that the value defined here, a new thread will be created to process the request.

100
snd_alive_sec

Keep-alive time in seconds for idle threads in the worker pool. Once this time has elapsed for an idle thread, it will be destroyed.

The purpose of this parameter is to optimise the usage of resources by avoiding wastage that results from having idle threads.

5
snd_qlen

The length of the queue that is used to hold runnable tasks to be executed by the request processing worker pool.

If the number of live threads is equal to the core pool size (snd_t_core) and all threads are busy, new requests will be pushed into the queue so that they can be processed when a thread becomes available.

If you need new threads to be created beyond the core pool size (snd_t_core), ensure you change the default value of this parameter so that it becomes a bounded queue.

If the queue is full, all threads are busy and the number of live threads is equal to the max pool size (snd_t_max), new requests will be rejected by the request processing worker.
-1
snd_io_threadsListener-side IO workers.2

Other parameters

Parameter NameDescriptionDefault Value
http.block_service_listIf this parameter is set to true, all the services deployed to the WSO2 ESB cannot be viewed from the http(s):<esb>:8280/services/ URL.false
http.user.agent.preserve

If this parameter is set to true,the User-Agent HTTP header of messages passing through the ESB will be preserved.

false

Example

The following example shows excerpts from a nhttp.properties file.

#
#        http://www.apache.org/licenses/LICENSE-2.0
#
# This file contains the configuration parameters used by the Non-blocking HTTP transport
#http.socket.timeout=60000
#nhttp_buffer_size=8192
#http.tcp.nodelay=1
#http.connection.stalecheck=0
# Uncomment the following property for an AIX based deployment
#http.nio.interest-ops-queueing=true

# HTTP Listener thread pool parameters
#snd_t_core=20
#snd_t_max=100
#snd_alive_sec=5
#snd_qlen=-1
#snd_io_threads=2
# HTTP Sender thread pool parameters
#lst_t_core=20
#lst_t_max=100
#lst_alive_sec=5
#lst_qlen=-1
#lst_io_threads=2
nhttp.rest.dispatcher.service=__MultitenantDispatcherService
# URI configurations that determine if it requires custom rest dispatcher
rest_uri_api_regex=\\w+://.+:\\d+/t/.*|\\w+://.+\\w+/t/.*|^(/t/).*
rest_uri_proxy_regex=\\w+://.+:\\d+/services/t/.*|\\w+://.+\\w+/services/t/.*|^(/services/t/).*

For information on tuning performance of WSO2 ESB using these properties, see Performance Tuning.