Sizing of the engine with examples

Jerome.Jargot
Blog Categories: 

Component: Bonita | Version: 7.9

This document is intended to avoid unwanted SERVICE OUTAGE and pause in the execution of processes. There is below a known list of problems:

  • the Bonita Engine stops when no XA connection is available for a worker thread.
  • some process execution are paused when works are lost because the work queue is full.
  • some intermediary timer never fires because the Quartz threads are not able to manage the associated amount of Triggers.
  • some intermediary timer never fires because a lake of connection make quartz change the Trigger's state to ERROR
  • some tasks' state are changed to ERROR because is no XA connection available in the business data datasource (BusinessDataDSXA)

Abitrary values had been chosen in order to illustrate how to implement the configuration. This documentation does not explain how to find the proper values for a specific environment.

Note that load and performance tests should be run to adjust the settings to the specifics of the application in the production environment.

There is below the list of assumptions used in this document:

  • the Bonita Engine has already been successfully started once: the database's connection settings had been already implemented.
  • the Bonita Engine is currently stopped.
  • only the default tenant with id 1 exists (created automatically at first startup)
  • the incoming traffic hits only one Connector, using HTTP (no HTTPS, nor AJP)
  • there is enough RAM (more than 10GB): when started the application server won't generate disk I/O (no SWAP activity)
  • Linux OS is used
  • the application server is started with start-bonita.sh: as a consequence the configuration files from setup/*-template/ are used.
  • Java 11 is used

If these assumptions do not match the environment that needs to be configured, then adapt this current example to the specifics of your environment.

Sizing to avoid Service Outage

Make sure the server hosting the application server with Bonita meets the hardware requirements described in these pages:

Download the Bonita Engine configuration files on the local disk

cd setup/
./setup.sh pull

From this point the Bonita Engine configuration files are located in the setup/platform_conf/current directory.

Configure the Bonita Engine

  • the queue associated to the connector works
    • bonita.tenant.connector.queueCapacity=100000
  • the number of connector threads
    • bonita.tenant.connector.corePoolSize=48
    • bonita.tenant.connector.maximumPoolSize=48
  • the number of worker threads
    • bonita.tenant.work.corePoolSize=64
    • bonita.tenant.work.maximumPoolSize=64
  • the size of the work-queue
    • bonita.tenant.work.queueCapacity=1000000
  • the number of Quartz threads
    • bonita.platform.scheduler.quartz.threadpool.size=10

1. Edit the tenants/1/tenant_engine/bonita-tenant-community-custom.properties file
2. Uncomment and set the properties below

bonita.tenant.connector.queueCapacity=100000
bonita.tenant.connector.corePoolSize=48
bonita.tenant.connector.maximumPoolSize=48

bonita.tenant.work.corePoolSize=64
bonita.tenant.work.maximumPoolSize=64
bonita.tenant.work.queueCapacity=1000000

3. Edit the platform_engine/bonita-platform-community-custom.properties file
4. Uncomment and set the property below

bonita.platform.scheduler.quartz.threadpool.size=10

Save the Bonita Engine configuration files into the database

cd setup/
./setup.sh push

At next startup the Bonita Engine will use the configuration files saved in the database.

Configure the Java process and the Application Server

Note that some values below are calculated with the ones already set from the previous section:

  • configure the Java process:
    • -Xms7168m
    • -Xmx8192m
    • -XX:MaxMetaspaceSize=512m
    • -XX:+UseConcMarkSweepGC
  • limit the number of incoming HTTP requests to 60 (Connector protocol="HTTP/1.1")
  • set the min to 20 and the max to 185 for the XA connections to the Bonita Engine database (bonitaDS). The max is a computed value: 185 is the sum of the numbers listed below.
    • number of incoming HTTP: 60
    • number of Quartz threads + 3: 13
    • number of worker threads: 64
    • number of connector threads: 48
  • set the min to 20 and the max to 172 for the XA connections to the Bonita Engine database (BusinessDataDS). The max is a computed value: 172 is the sum of the numbers listed below.
    • number of incoming HTTP: 60
    • number of worker threads: 64
    • number of connector threads: 48
  • set the min to 1 and the max to 13 for the non XA connections to the Bonita Engine database (bonitaSequenceManagerDS). The max is a computed value:
    • number of Quartz threads + 3: 13
  • set the min to 1 and the max to 13 for the non XA connections to the business data database (NotManagedBizDataDS). The max is a computed value:
    • number of Quartz threads + 3: 13

BonitaSubscription-7.9.0-Tomcat-8.5.34

See also the JDBC Data Sources section in the Apache Tomcat 8 page.

Edit setup/tomcat-templates/setenv.sh
Modify the line below

CATALINA_OPTS="${CATALINA_OPTS} ${PLATFORM_SETUP} ${H2_DATABASE_DIR} ${DB_OPTS} ${BDM_DB_OPTS} ${BTM_OPTS} ${INCIDENT_LOG_DIR} -Dfile.encoding=UTF-8 -Xshare:auto -Xms7168m -Xmx8192m -XX:MaxMetaspaceSize=512m -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:/dev/./urandom"

Edit server/conf/server.xml
Modify the attribute below in the Connector protocol="HTTP/1.1" xml element

    maxThreads="60"

Edit setup/tomcat-templates/bonita.xml
Modify these 4 attributes' values from the Resource name="bonitaDS" xml element

    initialSize="20"
    maxTotal="185"
    minIdle="20"
    maxIdle="40"

Modify these 4 attributes' values from the Resource name="BusinessDataDS" xml element

    initialSize="20"
    maxTotal="172"
    minIdle="20"
    maxIdle="40"

Modify these 4 attributes' values from the Resource name="bonitaSequenceManagerDS" xml element

    initialSize="1"
    maxTotal="13"
    minIdle="1"
    maxIdle="13"

Modify these 4 attributes' values from the Resource name="NotManagedBizDataDS" xml element

    initialSize="1"
    maxTotal="13"
    minIdle="1"
    maxIdle="13"

BonitaSubscription-7.9.0-wildfly-10.1.0.Final

Edit BonitaSubscription-7.9.0-wildfly-10.1.0.Final/server/bin/standalone.conf file
Modify the line below

JAVA_OPTS="-Xms7168m -Xmx8192m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=512m -XX:+UseConcMarkSweepGC -Djava.net.preferIPv4Stack=true"

Edit BonitaSubscription-7.9.0-wildfly-10.1.0.Final/setup/wildfly-templates/standalone.xml
Modify the content in the <subsystem xmlns="urn:jboss:domain:undertow:3.1"> element
Add these 3 lines

        <filters>
            <request-limit name="limit-connections" max-concurrent-requests="60" queue-size="60"/>
        </filters>

Add the <filter-ref name="limit-connections"/> element in the host xml element

            <host name="default-host" alias="localhost">
                <filter-ref name="limit-connections"/>

Modify the xml elements' values listed below in the <xa-datasource jndi-name="java:jboss/datasources/bonitaDS"

                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>185</max-pool-size>

Modify the xml elements' values listed below in the <xa-datasource jndi-name="java:jboss/datasources/bonitaSequenceManagerDS"

                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>13</max-pool-size>

Modify the xml elements' values listed below in the <xa-datasource jndi-name="java:jboss/datasources/BusinessDataDS"

                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>172</max-pool-size>

Modify the xml elements' values listed below in the <xa-datasource jndi-name="java:jboss/datasources/NotManagedBizDataDS"

                    <min-pool-size>1</min-pool-size>
                    <max-pool-size>13</max-pool-size>

Configure the max default transaction timeout for XA connections

Please read this other page: What to do when there are XA Transaction Timeout?

Configure the Soft limit of the file-descritors

see Resolution section in the What to do if you have an Internal Server Error 500 (Too many open files) ? page

Configure the database server

At least 400 incoming connections must be accepted: the sum of the connections defined in the application server's pools plus some additional ones for administrative tasks.

Notifications