Performance Tuning Configuration
Overview
This guide provides configuration guidelines on how to tune Wildfly Application Server for maximum performance for a medium to large number of transactions.
For very high number of transactions, it is recommended to setup Wildfly on a cluster by following this guide.
Memory Configuration
For maximum performance, it is required to allocate the maximum memory possible to Wildfly.
Note that this configuration should NOT exceed the 70% of operating system memory to avoid undesirable side effects such as paging.
To configure the Java heap size, you should edit the WILDFLY_DIR/bin/standalone.conf and modify the JAVA_OPTS variable by setting the -Xmx to the 70% of your available memory as the example below.
JAVA_OPTS="-Xms2g -Xmx6g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70"
I/O Thread Configuration
To be able to serve a high number of requests, it is important to set the number of worker threads.
One way to do that is through Wildfly CLI (Command Line Interface) by running the .WILDFLY_DIR/bin/jboss-cli.sh and the commands as the example below.
connect /subsystem=io/worker=default/:write-attribute(name=task-max-threads,value=100) /subsystem=io/worker=default/:write-attribute(name=io-threads,value=100)
EJB Container Configuration
By default Wildfly EJB Pooling is disabled. To enable this feature and benefit in terms of performance, you should use the CLI command as the example below.
/subsystem=ejb3/:write-attribute(name=default-slsb-instance-pool,value=slsb-strict-max-pool)
Database Connections
The Wildfly default maximum pool size for database connections is 20 which is low.
To increase it, replace "MyDataSource" with your datasource name and run the CLI command as the following example.
Note that when setting this value, you should keep in mind the maximum number of connections allowed by your database server.
/subsystem=datasources/data-source=MyDataSource/:write-attribute(name=max-pool-size,value=600)