Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The default distribution of WSO2 BPS comes with an embedded H2 database as the BPEL engine's persistence storage along with other settings suitable for development environment. However, it is recommended that some of these configurations be changed when moving to production. Configuration setting may change depending on the number of requests BPS is going to handle per second, your auditing and monitoring requirements, performance requirements and nature of your processes.

Given below The following are the key points to note:

External Database

.

Table of Contents
maxLevel3
minLevel3

OS-level settings

  1. To optimize network and OS performance, configure the following settings in /etc/sysctl.conf file of Linux. These settings specify a larger port range, a more effective TCP connection timeout value, and a number of other important parameters at the OS-level.

    Info

    It is not recommended to use net.ipv4.tcp_tw_recycle = 1 when working with network address translation (NAT), such as if you are deploying products in EC2 or any other environment configured with NAT.

    Code Block
    net.ipv4.tcp_fin_timeout = 30
    fs.file-max = 2097152
    net.ipv4.tcp_tw_recycle = 1
    net.ipv4.tcp_tw_reuse = 1
    net.core.rmem_default = 524288
    net.core.wmem_default = 524288
    net.core.rmem_max = 67108864
    net.core.wmem_max = 67108864
    net.ipv4.tcp_rmem = 4096 87380 16777216
    net.ipv4.tcp_wmem = 4096 65536 16777216
    net.ipv4.ip_local_port_range = 1024 65535      
  2. To alter the number of allowed open files for system users, configure the following settings in /etc/security/limits.conf file of Linux (be sure to include the leading * character).

    Code Block
    * soft nofile 4096
    * hard nofile 65535

    Optimal values for these parameters depend on the environment.

  3. To alter the maximum number of processes your user is allowed to run at a given time, configure the following settings in  /etc/security/limits.conf file of Linux (be sure to include the leading * character). Each carbon server instance you run would require up to 1024 threads (with default thread pool configuration). Therefore, you need to increase the nproc value by 1024 per each carbon server (both hard and soft).

    Code Block
    * soft nproc 20000
    * hard nproc 20000

External database

Configure an external database server such  such as MySQL as the persistence storage instead of embedded H2 database. Althogh Although slight performance gains can be experienced when using simple BPEL processes with H2 database, it cannot handle multiple concurrent requests and complex processes with the same efficiency.

JDBC connections

JDBC connections are useful when your application requires high throughput.

BPS has two engines; Apache ODE BPEL processor and HumanTask engine. These two engines are tightly coupled with the database layer and their function is to persist instance data into the database. Thus, for BPS to function properly, you need to allocate enough database connections for BPS datasource. Both these engine share same BPS datasource and database connections so we generally recommend allocating 50% of database connections for each engine for an application running with both BPEL and HumanTask.

For example if you have a total 100 database connections for a BPEL and HumanTask application, you can use upto 50 database connections for the ODE engine and leave the rest of the database connections for HumanTask operations. If you have only BPEL in your application, you can allocate many more database connections for the ODE engine.

Note

Also note that, even you have allocated higher number of database connections for the BPS datasource, performance may not increase as expected. One reason for this could be that there are not enough database sessions from the database side. If that is the case, you need to increase the number of database sessions from database side.

Multi-Threaded Http Connection Manager

Configure 'multi-threaded Http connection manager' Configure the BPS datasource by editing the <BPS_HOME>/repository/conf/datasources.properties file and changing the following.

Code Block
synapse.datasources.bpsds.validationQuery=SELECT 1 FROM DUAL
synapse.datasources.bpsds.dsName=bpsds
synapse.datasources.bpsds.maxActive=100
synapse.datasources.bpsds.maxIdle=20
synapse.datasources.bpsds.maxWait=10000

ODE scheduler threads

ODE scheduler threads are useful when your application requires high throughput.

In the ODE engine, every scheduler thread is associated with a database connection. So the rule of thumb is; the number of ODE scheduler threads should be less than or equal to number of database connections allocated for the ODE engine. If this is not followed, some threads may not work properly as they cannot acquire a database connection to work. For example, in an application that uses both BPEL and HumanTask, if you have a total 100 database connections, you can allocate 50 threads for the ODE scheduler. This will guarantee that at a given time, only 50 database connections are acquired by the ODE engine.

Configure this by adding the following to the <BPS_HOME>/repository/conf/bps.xml file.

Code Block
<tns:odeschedulerthreadpoolsize>50</tns:odeschedulerthreadpoolsize>

Multi-threaded HTTP connection manager

Configure multi-threaded HTTP connection manager connection pool settings to suit your BPEL processes. Typically, the HTTP connection manager should be configured to be in sync with the concurrent HTTP connections in the BPS serverBPS. This is necessary when you have a lot of internal or external service invocations.

There are two configurations in Http HTTP connection manager. One is 'max total connections' and the other is 'max total connection per host'. These settings depend on the number of concurrent requests BPS needs to handle, and the number of external service calls per process instance. For example, Also, if your processes do a lot of service invocation to localhost (or a particular host), then it is necessary to increase the maxConnectionsPerHost configuration.

Configure the <BPS_HOME>/repository/conf/bps.xml file to set specific values as shown below.

Code Block
languagehtml/xml
<tns:WSO2BPSxmlns:tns="http://wso2.org/bps/config">
    ...
    <tns:MultithreadedHttpConnectionManagerConfig><tns:maxConnectionsPerHostvalue="20"/><tns:maxTotalConnectionsvalue="200"/></tns:MultithreadedHttpConnectionManagerConfig>
    ...
</tns:WSO2BPS>

TimeOuts

BPEL Process Persistence

This configuration is relevant when partner services take more time to response. When partner services are slow or take more time to response, callee BPEL process's invoke activity fails due to message exchange timeout. By increasing time will avoid these kind of failures. Also note that, slow partner services will slow entire BPEL process. This will cause to timeout the client application. Thus it is required increase timeout interval for client application. To do this, configure the <BPS_HOME>/repository/conf/bps.xml file and the <BPS_HOME>/repository/conf/axis2/axis2.xml file as shown below.

Code Block
languagexml
titlebps.xml
<tns:MexTimeOut value="600000"/> 
<tns:ExternalServiceTimeOut value="600000"/>
Code Block
languagexml
titleaxis2.xml
<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> 
        <parameter name="PROTOCOL">HTTP/1.1</parameter> 
        <parameter name="Transfer-Encoding">chunked</parameter> 
        <!-- This parameter has been added to overcome problems encounted in SOAP action parameter --> 
        <parameter name="OmitSOAP12Action">true</parameter> 
        <parameter name="SO_TIMEOUT">600000</parameter> 
        <parameter name="CONNECTION_TIMEOUT">600000</parameter> 
</transportSender>

Here you must increase the default values for message exchange timeout and external service invocation timeout. Also set the SO_TIMEOUT parameter and CONNECTION_TIMEOUT parameter in HttpSender. Increase the timeout value from the default value to 10 minutes.

HumanTask caching

HumanTask caching is important when you have to deal with a large user store. HumanTasks are tightly coupled with users and user roles/groups. Because of this, BPS does lot of user store lookups for HumanTask operations. These user store calls can take considerable amount of time, if the user store is large or located remotely. This degrades the performance of the entire HumanTask engine. Caching user and role lookup data at the BPS side will reduce these remote user store calls and improve the overall performance of the HumanTask engine.

Enable HumanTask caching in the <BPS_HOME>/repository/conf/humantask.xml file.

Code Block
languagexml
<cacheconfiguration>
	<enablecaching>true</enablecaching>
</cacheconfiguration>

Number of HumanTask scheduler threads

This is relevant when you are not using HumanTask deadline/escalation. HumanTask deadline and escalation are scheduled tasks that are executed by the HumanTask scheduler. By default, 50 threads are allocated for the HumanTask scheduler. If you are not using deadline/escalations, you can configure this value to a lower value such as 5. This will utilize idle threads in BPS server. Note that, you can't set this to 0, because the HumanTask engine has several internal scheduled tasks to run.

Configure this value in the <BPS_HOME>/repository/conf/humantask.xml file.

Code Block
languagexml
<schedulerconfig>
	<maxthreadpoolsize>5</maxthreadpoolsize>
</schedulerconfig>

BPEL process persistence

Configuring BPEL process persistence is recommended. If a process is implemented in the request-response interaction model, use in-memory processes instead of persistence processes. This decision mainly depends on the specific business use-case.

Process-to-

...

process communication

Use process-to-process communication. This reduces the overhead introduced by additional network calls, when calling one BPEL process from another deployed in the same BPS instance.

Event

...

filtering

Configure Configure event-filtering at  at process and scope level. A lot of database resources can be saved by reducing the number of events generated.

Process Instance Cleanup

Configure process instance cleanup. A large number of process instance data will be accumulated in the BPEL engine's persistence storage if processes are persisted. Process instance cleanup is used to reduce performance overhead introduced by database size. The process instance cleanup feature can be configured with periodic cleanup tasks based on various process instance properties, to remove data from WSO2 BPS persistence storage.

The 'Schedules' section in bps.xml can be used to configure instance cleanup. The 'Schedules' section can contain multiple 'Schedule' elements with multiple 'cleanup' elements. In each 'Schedule' element, the attribute 'when' states the time that the instance cleanup task gets executed. Time is configured using cron expressions (http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger). Inside the cleanup element, filter elements can be used with various instance properties, which help select the instance to be deleted.

For example, the following code schedule is configured to initiate a cleanup task at 5:11 PM every day to clean completed process instances.

Code Block
languagehtml/xml
<tns:Schedules>
    <tns:Schedule when="0 11 17 * * ?">
           <tns:cleanup>
                <tns:filter><![CDATA[status=completed]]></tns:filter>
           </tns:cleanup>
    </tns:Schedule>
</tns:Schedules>
Non-Visualized Environments

Non-visualized environments

Take precaution when deploying WSO2 BPS in virtualized environments. Random increases in network latencies and performance degradation have been observed when running BPS on VMs.

Process

...

hydration and

...

dehydration

One technique to reduce memory utilization of the BPS engine is process hydration and dehydration. User can configure the hydration/dehydration policy in $PRODUCT_HOME/repository/conf/bps.xml file or define a custom hydration/dehydration policy.

...

  • MaxAgevalue: Sets the maximum age of a process before it is dehydrated.
  • ProcessDehydrationmaxCount: The maximum deployed process count that can exist in memory at a particular time.

In-

...

memory execution

For performance purposes, a process can be defines as being executed only in-memory. This greatly reduces the amount of generated queries and puts far less load on the database. Both persistent and non-persistent processes can cohabit in WSO2 BPS.

...

Code Block
languagehtml/xml
<processname="pns:HelloWorld2"> 
    <in-memory>true</in-memory>
    <providepartnerLink="helloPartnerLink">
        <servicename="wns:HelloService"port="HelloPort"/>
    </provide>
</process>
Note
Info
title
In-memory executions put restrictions on the process and the process instances cannot be queried using the BPS Management API. Also, the process definition can only include a single receive activity (the one that will trigger the instance creation).
Note
Info
title

These best practices are valid for WSO2 BPS 2.1.0 onwards. Configuration details for these optimizations vary in older BPS versions. Also, these optimizations are supported by Apache ODE, but configuration is different from WSO2 BPS.

...