Troubleshooting
Problem
After deploying a Java Server Faces application to WebSphere Application Server v8.5 or v9.0 on IBM i OS, high CPU utilization may occur if the deployed Java Server Faces Application is not explicitly setting the javax.faces.FACELETS_REFRESH_PERIOD=-1 and javax.faces.PROJECT_STAGE=Production parameters in its web.xml deployment descriptor file.
Symptom
High CPU utilization by the WebSphere Application Server Java Virtual Machine job.
Cause
Java Server Facelets are being refreshed very frequently by JVM threads.
Environment
IBM i OS
WebSphere Application Server v8.5 and v9.0
Java Server Faces v2.0/v2.2
Resolving The Problem
Update the Java Server Faces web application's web.xml (deployment descriptor) file to set the following context parameters. Then, update or re-deploy the application in WebSphere Application Server and restart the web application.
IBM recommends explicitly defining these context parameters for all production Java Server Faces applications to prevent unexpected high CPU consumption.
This interval specifies the amount of time the Facelets compiler has to wait until checking for changes in pages.
In development, it is recommended to set the value of (javax.faces.FACELETS_REFRESH_PERIOD) parameter to a low value in order to help the JSF developers during development to be able to edit pages while the application is running.
This interval specifies the amount of time the Facelets compiler has to wait until checking for changes in pages.
In development, it is recommended to set the value of (javax.faces.FACELETS_REFRESH_PERIOD) parameter to a low value in order to help the JSF developers during development to be able to edit pages while the application is running.
In production and in order to gain better performance, it is recommended to set the value of (javax.faces.FACELETS_REFRESH_PERIOD) parameter to -1 (which means that you don’t want the compiler to check for changes once the page is compiled).
<context-param>
<param-name>javax.faces.FACELETS_REFRESH_PERIOD</param-name>
<param-value>-1</param-value>
</context-param>
Sets the Java Server Faces application into Production, which identifies its stage in the Software Development Lifecycle. This context parameter influences the defaults for several other Java Server Faces context parameters, including javax.faces.FACELETS_REFRESH_PERIOD if they are not explicitly defined. For example, when javax.faces.PROJECT_STAGE is set to Development, javax.faces.FACELETS_REFRESH_PERIOD is set to 2 by defualt. When javax.faces.PROJECT_STAGE is set to Production, javax.faces.FACELETS_REFRESH_PERIOD is set to -1 by default.
<context-param>
<description>
A human readable string describing where this particular JSF application is
in the software development lifecycle.
Valid values are 'Development', 'UnitTest', 'SystemTest' and 'Production'.
Default is 'Production'.
This parameter is not available in JSF 1.x.</description>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
You can also consider setting the following to skip comments.
Setting (javax.faces.FACELETS_SKIP_COMMENTS) parameter to true can help reducing the amount of data sent across the network by removing comments from Facelets pages. These comments can be useful for understanding the code during development, but they are unnecessary during deployment, and in the same time, they can create a security risk by allowing the system users looking into the source code comments.
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000001kDnAAI","label":"WebSphere Application Server->Java Server Faces"}],"ARM Case Number":"TS005895879","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"7.2.0;7.3.0;7.4.0;and future releases"}]
Was this topic helpful?
Document Information
Modified date:
28 October 2021
UID
ibm16509572