I’m working on a JSF project with MyFaces 1.2.6 and RichFaces 3.3.1GA. The UI components work well but I’m having performance issues.
The main problem is that RichFaces keeps loading JavaScript files on every page request instead of using browser cache. This makes the application really slow for users.
I want to implement some performance optimization techniques but I can’t modify the generated HTML and JavaScript that RichFaces creates automatically.
Has anyone found good ways to improve RichFaces performance on the client side? Any configuration changes or best practices that help with caching and loading speed?
Server-side tweaks can significantly enhance RichFaces performance beyond merely relying on client-side caching. Based on my experience with similar RichFaces versions, enabling GZIP compression in your web server can reduce JavaScript file sizes by 60-70%. Additionally, by setting org.richfaces.RESOURCE_OPTIMIZATION_ENABLED to true in your web.xml, you can bundle multiple resource requests into fewer HTTP calls. It’s also advisable to switch javax.faces.PROJECT_STAGE to Production mode, which optimizes resource handling and disables debug features. Consider hosting common JavaScript libraries on a CDN, allowing browsers to utilize cached versions from other sites. Finally, evaluate the components you are using; often, there are heavier components that can be replaced with more lightweight alternatives that serve the same purpose.
check if u’re using ajax polling components like a4j:poll - those constantly refresh resources. also disable any unnecessary ajax regions since they trigger extra js loads even when you don’t need them.
which richfaces components are giving you trouble? try switching to a simpler skin - it cuts down on js overhead. what browser are you mainly testing on?
i’ve faced the same issue using RichFaces 3.x. try adjusting the resource cache timeout in your web.xml with org.richfaces.RESOURCE_CACHE_SIZE parameter. also, make sure to check your app server’s settings for static resource caching - that often causes the slowdown, not RichFaces itself.
That JavaScript loading issue usually happens when RichFaces sends bad HTTP headers with its resources. I’ve dealt with this in RichFaces 3.3.1GA - just configure your app server to set proper cache-control headers for anything under /a4j/ and /richfaces/ paths. That fixes most caching problems.
Also check that org.ajax4jsf.handleViewExpiredOnClient is set right in your web.xml. Wrong settings here force unnecessary resource reloads.
What really worked for me was putting Apache HTTP Server as a reverse proxy in front of the app server. Configure it to cache RichFaces static resources with long expiration times. This completely bypasses the framework’s resource handling after the first request.
are you seeing this slowness on all pages or just the ones with heavy components? have you checked the actual network requests? sometimes it’s not a caching issue - just too many simultaneous resource calls killing performance.