3

How to improve performance of jsf myfaces based application ?

Some tips that I have collected so far

Trinidad

  • Set following init parameters to false in web.xml
    • org.apache.myfaces.trinidad.DEBUG_JAVASCRIPT
    • org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION
    • org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION
  • use client-side state saving
  • clear pageflow context map when not in use

Myfaces

  • Set following init parameters to false in web.xml
    • org.apache.myfaces.COMPRESS_STATE_IN_SESSION
    • org.apache.myfaces.SERIALIZE_STATE_IN_SESSION
    • org.apache.myfaces.PRETTY_HTML
    • org.apache.myfaces.VALIDATE
  • Reduce value of org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION from init param (default is 20)

facelets

  • Set following init parameters to false in web.xml
    • facelets.DEVELOPMENT
    • facelets.SKIP_COMMENTS
  • set facelets.BUFFER_SIZE and com.sun.faces.responseBufferSize to large value like 10000000
  • set facelets.REFRESH_PERIOD to -1

Is there anything else to add to this ?

Prashant Bhate
  • 10,907
  • 7
  • 47
  • 82

2 Answers2

2

Moving to Stateless JSF would offer a great performance boost. Now it's possible to use JSF entirely stateless. See this blog & this issue. A payoff is that you can't create views dynamically (e.g. by binding, JSTL tags, etc), nor manipulate it after creation.


A Stateless JSF operation mode would be incredibly useful for high-load applications and architectures:

https://web.archive.org/web/20140626062226/http://industrieit.com/blog/2011/11/stateless-jsf-high-performance-zero-per-request-memory-overhead/#comment-4

This has previously been suggested by Jacob: http://weblogs.java.net/blog/jhook/archive/2006/01/experiment_goin.html

This would help JSF ditch the stigma of "slow and memory hog," and help keep up with current tech trends (stateless architectures.)

stiemannkj1
  • 4,418
  • 3
  • 25
  • 45
Rajat Gupta
  • 25,853
  • 63
  • 179
  • 294
1

Came across the following link. Will be useful if you're using ADF based (now MyFaces Trinidad) implementation.

http://download.oracle.com/docs/cd/B31017_01/web.1013/b28967/web_getstarted006.htm

adarshr
  • 61,315
  • 23
  • 138
  • 167