1

I have a wizard based screen which allows user to go to next and previous pages. On back or next, I submit the page and save the forms in session using @SessionScoped Managed beans. Functionality works fine if I leave the NUMBER_OF_VIEWS_IN_SESSION to default as 20, but reducing it to below 10 stops the page flow (no error displayed). What is wrong here and How to optimize the size of NUMBER_OF_VIEWS_IN_SESSION?

 <context-param>
        <param-name>org.apache.myfaces.NUMBER_OF_VIEWS_IN_SESSION</param-name>
        <param-value>1</param-value>
 </context-param>

I am using MyFaces.

6
  • 1
    I think default is 20 and not 0. Jun 29, 2012 at 14:41
  • You should probably read this answer by BalusC, as mentioned I think it depends on the number of POST requests you make on your page. Jun 30, 2012 at 1:58
  • @Ravi: Thanks. Link shared was useful to clear my understanding. My internet facing application is expected to get more than 50k concurrently logged in users during peak hours. Also i have few pages (wizards) accessible to unauthenticated users. Every access to page will add on to size of session and hence susceptible to probable DoS attack. Yes we will setup various hardware to check DoS attacks, but I would like to strengthen the application if feasible. Is it possible to clear certain views from session? Any other suggestion on optimizing this memory usage?
    – ad-inf
    Jun 30, 2012 at 5:12
  • 1
    I would say instead of messing with the number of views in session. If your myfaces core is 2.0 or higher by default javax.faces.STATE_SAVING_METHOD is set to server and javax.faces.PARTIAL_STATE_SAVING is set to true which means that only part of the changes are saved. More info . If even this is heavy on your application server set the state_saving_method to client where the view data is encoded and stored in a hidden field on the page. Jun 30, 2012 at 19:45
  • But beware don't use client side for sensitive sites as they are prone to padding oracle attacks link Jun 30, 2012 at 19:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.