Tip

Performance and troubleshooting tips for JSF 2.0 Facelet developers

JSF 2.0 has provided a variety of new configuration settings to help improve performance and aid the troubleshooting task, making the lives of software developers and quality engineers much easier.

JSF 2.0 introduced a variety of new features, with the addition of the Facelets specification being the most widely anticipated by software engineers and application developers alike.

Facelets became the de facto GUI standard for JSF.

Many JSF developers are familiar with Facelets, as it slowly became the de facto standard for doing GUI development with prior versions of JSF. However, many software engineers are currently developing Facelets using the JSF 2.0 framework without proper  knowledge of the various configuration parameters that the latest edition introduced into the language. There are three new configuration parameters that deal specifically with Facelets in JSF 2.0, and every developer should be aware of them, not only because they can be helpful during development, but also because failing to configure them appropriately at deployment time can result in needless performance degradations at runtime.

The three key configuration settings every Facelets developer should be aware of are:

  1. facelets.SKIP_COMMENTS
  2. facelets.REFRESH_PERIOD
  3. facelets.DEVELOPMENT

facelets.SKIP_COMMENTS can help reduce the amount of data sent across the network by removing comments from the various pages your Facelets create. These comments can be very helpful during development, but they are unnecessary during deployment, and more to the point, it can create a security risk by allowing end users to peek at your source code comments. Having an impact on both security and performance, this is an important setting to keep track of.

facelets.REFRESH_PERIOD is used to configure how often the framework will poll your pages in order to check for changes. This number should be kept low during development, but it can be set to a much higher value at production time, as your Facelets are unlikely to change after deployment. There is a chance someone might need to update a live file, so turning this feature off entirely isn't always a good idea, but if you are confident in your deployment time governance, you can turn file checking off entirely by setting this parameter to minus one, -1.

facelets.DEVELOPMENT tells the JSF environment to print out debugging info for errors. This is helpful during development, but it has no useful purpose after deployment unless you are troubleshooting an error or problem in your live environment. Keep this set to true during development, but be sure to turn it off for deployment.

By knowing how to configure these values during development and during deployment, JSF applications that use Facelets will be easier to build, easier to troubleshoot and they will perform better when they go live into production.

Do you have any tips for improving the performance of your JSF applications? Let us know how you performance tune you JSF applications.

Dig Deeper on DevOps-driven, cloud-native app development