Performance tuning for Open Liberty
Open Liberty supports various parameters and configuration options to influence application performance. You can tune settings for the Java virtual machine (JVM), the transport channel services, and more to improve performance.
The following sections provide more information about tuning parameters and attributes.
Tune the JVM
For more information on the JVM tuning options for IBM Java, see Eclipse OpenJ9 .
Tune transport channel services
Server configuration | Attribute | Example | Description |
---|---|---|---|
|
<httpOptions maxKeepAliveRequests="-1" /> |
This option specifies the maximum number of persistent requests that are allowed on a single HTTP connection if persistent connections are enabled. A value of -1 means unlimited. This option supports low latency or high throughput applications, and TLS connections for use in situations where building up a new connection can be costly. |
|
|
<connectionManager ... maxPoolSize="40" /> |
This option specifies the maximum number of physical connections for the connection pool. The default value is 50. The optimal setting here depends on the application characteristics. For an application in which every thread obtains a connection to the database, you might start with a 1:1 mapping to the
|
|
|
<connectionManager ... purgePolicy="FailingConnectionOnly" /> |
This option specifies which connections to end when a stale connection is detected in a pool. The default value is the entire pool. In some cases, you might want to purge only the failing connection by specifying the
|
|
|
<connectionManager ... numConnectionsPerThreadLocal="1" /> |
This option specifies the number of database connections to cache for each executor thread. This setting can provide a major improvement on large multi-core machines by reserving the specified number of database connections for each thread. Using thread-local storage for connections can increase performance for applications on multi-threaded systems. When you set
|
|
|
<dataSource ... statementCacheSize="60" > |
This option specifies the maximum number of cached prepared statements per connection. To set this option, review the application code (or an SQL trace that you gather from the database or database driver) for all unique prepared statements. Ensure that the cache size is larger than the number of statements. |
|
|
<dataSource ... isolationLevel="TRANSACTION_READ_COMMITTED"> |
The data source isolation level specifies the degree of data integrity and concurrency, which in turn controls the level of database locking. Different options are available for the default transaction isolation level. For more information, see
|
Tune the default executor
The Open Liberty default executor is self-tuning and adapts to the current workload by dynamically adding or removing threads. For most workloads, the executor does not require any tuning, and you are advised not to change any settings of the executor unless you encounter specific problems with thread creation. For more information, see Thread pool tuning .
Reduce idle server CPU time
To reduce idle server CPU time, add the following attributes to the
server.xml
file.
<applicationMonitor dropinsEnabled="false" updateTrigger="disabled"/>
<config updateTrigger="disabled"/>
When the attributes are added, your server no longer monitors for configuration or application updates.
You can also set the
updateTrigger
attribute to the
MBean
value for both the
applicationMonitor
element and the
config
element. This setting allows applications and configurations to be updated by an
MBean
method. However, some amount of CPU time is used. To reduce the amount of CPU time used, you can set the
pollingRate
attribute of the
applicationMonitor
element and the
monitorInterval
attribute of the
config
element to large values.
The following example shows how to reduce the amount of CPU time that is used when you set the
updateTrigger
attribute to the value of
MBean
.
<applicationMonitor updateTrigger="mbean" pollingRate="60s"/>
<config updateTrigger="mbean" monitorInterval="60s"/>
Tune startup time
Open Liberty provides convenience features , such as MicroProfile or JakartaEE , which include many individual Liberty features. The convenience features are handy for development environments, when the scope of application function might not be finalized and you want to have all the features readily available. However, each added feature requires server resources during server startup.
You can improve startup times by including only the necessary features in your deployment configuration. A configuration that includes features that are not used by the deployed application might require more CPU, memory, and time to start than necessary. You can use the Open Liberty dev mode to automatically generate a list of the features that your application needs .
By default, the
Jakarta Contexts and Dependency Injection (CDI)
feature scans all application archives. This feature can increase startup time substantially, particularly in larger applications. You can disable implicit archive scanning by setting the
enableImplicitBeanArchives
attribute to
false
. This setting skips the scanning of archives unless they contain a
beans.xml
file.
<cdi12 enableImplicitBeanArchives="false"/>
The
CDI
feature might be included in your server configuration even if it is not explicitly specified in your
server.xml
file because other features might implicitly enable it. For example, the
MicroProfile
feature and the
Jakarta EE Web Profile
feature each enable the CDI feature by default.