This documentation is for WSO2 Business Process Server 3.2.0. View documentation for the latest release.

Unknown macro: {next_previous_link3}
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

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 are the key points to note:

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.

    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.

    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).

    * 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 upto 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).

    * soft nproc 20000
    * hard nproc 20000

External database

Configure an external database server such as MySQL as the persistence storage instead of embedded H2 database. 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.

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.

Configure the BPS datasource by editing the <BPS_HOME>/repository/conf/datasources.properties file and changing the following.

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 db connection. So the rule of thumb is, number of ODE scheduler threads should be less than or equal to number of db connections allocated for ODE engine. Otherwise some threads may not work properly, because they can't acquire a db connections to work.  For example In BPEL + HumanTask scenario, if you have total 100 db connections, your can allocate 50 threads for ODE scheduler. This will guarantee that at a given time, only 50 db connections are acquired by ODE engine.

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 BPS.

There are two configurations in Http connection manager. One is 'max total connections' and 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,

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

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 event-filtering at process and scope level. A lot of database resources can be saved by reducing the number of events generated.

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.

The following example enables the dehydration policy and sets the maximum deployed process count that can exist in memory at a particular time to 100. The maximum age of a process before it is dehydrated is set to 5 minutes.

<tns:ProcessDehydrationmaxCount="100"value="true"><tns:MaxAgevalue="300000"/></tns:ProcessDehydration>
  • 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.

Shown below is an example of declaring a process as in-memory simply by adding an in-memory element in the deploy.xml file.

<processname="pns:HelloWorld2"> 
    <in-memory>true</in-memory>
    <providepartnerLink="helloPartnerLink">
        <servicename="wns:HelloService"port="HelloPort"/>
    </provide>
</process>
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).

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.

  • No labels