Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Significance of FACELETS_BUFFER_SIZE?

Tags:

jsf

primefaces

I'm working on a pretty big JSF application using Mojarra 2.1.13 and Primefaces 3.5. Recently I had an issue of getting java.lang.IllegalStateException: Cannot create a session after the response has been committed exception. I cleared it by increasing the FACELETS_BUFFER_SIZE by using context-param in my web.xml. Evenlthough I am not getting that exception anymore I have some questions regarding that:

  1. How significant is the FACELETS_BUFFER_SIZE setting in a JSF app?
  2. Does it affect the performance of the app (I want to avoid any
    surprises/issues regarding this) Are there any advantages and disadvantages performance-wise?
  3. What happens if it's set to more/less than my application's
    requirement?
  4. How do I find the optimal FACELETS_BUFFER_SIZE for my application?
like image 535
Kishor Prakash Avatar asked Mar 09 '15 09:03

Kishor Prakash


1 Answers

FACELETS_BUFFER_SIZE represents the maximum amount of bytes that a buffer (i.g a form in our case) can be up to. It needs to be set in the web.xml only when the PROJECT_STAGE is set to Development.

When the PROJECT_STAGE is set to Production there is no need for the FACELETS_BUFFER_SIZE to be set and can be left in its default setting (-1). Setting the FACELETS_BUFFER_SIZE whilst in Development can prevent data loss or errors not logging correctly or even at all.

Setting this param to Development enables better error messages, including in the client-side JavaScript, at the cost of some performance.

While setting this param to Production will turn off some error messages, and emphasize performance.

The value (bytes) set in FACELETS_BUFFER_SIZE while PROJECT_STAGE is set to Development should be higher than your maximum size of your most heavy pages. You can see that if you open your application in firefox, right click in empty space and click on View Page Info, the current page size is shown there.

like image 127
Sir. Hedgehog Avatar answered Dec 09 '22 00:12

Sir. Hedgehog