Persistent Connections

A Send HTTP Request activity requires a connection to the HTTP server. The activity exclusively uses the connection until the HTTP server sends the response message. If you have many process instances connecting to a HTTP server, each Send HTTP Request opens a connection, holds the connection, and then closes the connection when the activity completes. Opening and closing a large number of connections causes a significant overhead. Persistent connections play a major role here. Persistent connections maintain a pool of connections that can be reused by Send HTTP Request activities so that each activity does not need to open and close the connection. Once the connection is released by the process instance, it is returned to the pool maintained.

Note: Not all HTTP servers support the use of persistent connections. To determine if the HTTP Server supports the use of persistent connections, read the documentation of that HTTP Server.

Persistent HTTP Connection illustrates the persistent connection pool.

Persistent Connection Manager allows you to specify the total number of connections as well as the maximum number of connections per HTTP Server. The total number of connections is a total of connections to all HTTP Servers handled by that connection pool.

For each SSL configuration, a different Persistent Connection pool is created and maintained. All connections using the same SSL Configuration, irrespective of the HTTPS Server they are connecting to, is maintained by this pool.

When a Send HTTP Request activity requires a connection, the pool is requested for a connection that corresponds to the HTTP server. If an idle connection for that HTTP Server is found, it is used. If no idle connection is found, the pool tries to create one depending on whether the maximum connections limit for that HTTP Server has been reached. If the maximum connections limit is reached, the request waits for a connection to be released back to the pool. If the maximum connections limit is not reached, the pool creates a connection to use.

Figure 76: Persistent HTTP Connection

Persistent connections are managed by custom engine properties. For more information about setting custom engine properties, see TIBCO ActiveMatrix BusinessWorks™ Administration.

The following section describe the engine properties that control persistent connections.

bw.plugin.http.client.usePersistentConnectionManager

This property specifies that a pool of HTTP connections to each HTTP server must be created for the connections to be reused by the Send HTTP Request activities. This property enables persistent connections for all non-SSL Send HTTP Request in that ActiveMatrix BusinessWorks engine.

When this property is set to true, a pool of connections is created for each HTTP server that Send HTTP Request connects to. The total number of connections in the pool is limited by the bw.plugin.http.client.maxTotalConnections property. The number of connections for each host (each HTTP server) is limited by the bw.plugin.http.client.maxConnectionsPerHost property.

The default value of this property is false.

bw.plugin.http.client.usePersistentConnectionManagerForSSL

This property specifies that a pool of HTTPS connections to each HTTP server must be created for connections to be reused by the Send HTTP Request activities. This property enables persistent connections for all SSL Send HTTP Request in that ActiveMatrix BusinessWorks engine.

When this property is set to true, a pool of connections is created for each HTTPS server that Send HTTP Request connects to. The total number of connections in the pool is limited by the bw.plugin.http.client.maxTotalConnections property. The number of connections for each host is limited by the bw.plugin.http.client.maxConnectionsPerHost property.

The default value of this property is false.

Note: SSL Configuration - consists of Trusted Certificates folder, Identity, verifyHostName flag, and strongCipherSuites flag.
NTLM Authentication Configuration - consists of Identity and domainName.

Different connections pools get created for the following combinations:
HTTP
HTTP and NTLM
HTTPS (using SSL) and NTLM
HTTPS (using SSL)
All persistent connection properties like maxTotalConnections, maxConnectionsPerHost, idle connections check, and timeout value are applied on each connection pool.
Note: To enable Persistent Connections for both HTTP and HTTPS, set bw.plugin.http.client.usePersistentConnectionManager and bw.plugin.http.client.usePersistentConnectionManagerForSSL properties to true.
Note: Define the engine property bw.plugin.http.client.authentication.preemptive to False, if you don’t need the preemptive authentication applied for the HTTP Requests. The default value of this property is True.

bw.plugin.http.client.connectionTimeout

The value of this property is ignored unless the bw.plugin.http.client.usePersistentConnectionManager or bw.plugin.http.client.usePersistentConnectionManagerForSSL property is set to true. This property specifies that the timeout period (in milliseconds) for which persistent connections should be alive to each remote HTTP server.

The default value of this property is 3000 ms.

bw.plugin.http.client.maxConnectionsPerHost

The value of this property is ignored unless the bw.plugin.http.client.usePersistentConnectionManager or bw.plugin.http.client.usePersistentConnectionManagerForSSL property is set to true. This property specifies the maximum number of persistent connections to each remote HTTP server.

The default value of this property is 20.

bw.plugin.http.client.maxTotalConnections

The value of this property is ignored unless the bw.plugin.http.client.usePersistentConnectionManager or bw.plugin.http.client.usePersistentConnectionManagerForSSL property is set to true. This property specifies the maximum number of persistent connections for all HTTP servers.

The default value of this property is 200.

bw.plugin.http.client.checkForStaleConnectionsValidationTime

The value of this property is ignored unless the bw.plugin.http.client.usePersistentConnectionManager or bw.plugin.http.client.usePersistentConnectionManagerForSSL property is set to true. For

persistent connections, the HTTPComponent Library 4.5.5 defines the period of inactivity in milliseconds after which persistent connections must be re-validated before being allocated to the consumer. This check helps to detect connections that have become stale when the connections were kept inactive in the pool.

A non-positive value passed to this method disables connection validation. The default value of this property is 2000 ms.