5 Replies Latest reply on Oct 18, 2010 8:34 AM by gdfgd eqwe

    Statelessness hard to attain in Seam (or?)

    Tobias Hill Newbie

      We are currently having great problems with our system developed
      in Seam. The increased traffic we are experiencing (not only from
      users, but to a large degree from bots too) is really a hard blow
      for us and nodes in our cluster eventually but regularly crash (or
      become unresponsive) as a consequence of memory shortage. The chosen
      framework and view technology does not scale as good as expected.

      When investigating our quite pressing situation further we have
      found that things which we thought were stateless (and should be
      too) unfortunately are not.

      It seams that JSF/Facelets or Seam (my guess is JSF) is hanging in
      quite a lot of data in each started session for each page view. This
      is happening for every page where any jsf is present ... no matter
      how simple it is.

      The data which is being attached to the session is in the AjaxStateHolder
      and keyed as org.ajax4jsf.application.AjaxStateHolder. This structure quickly becomes large and given the arrival rate of requests
      from index bots (approx. 10-thousand requests per hour all starting new sessions)
      (on top of us serving our real users) ... memory runs out quickly.

      I have seen elsewhere people who are struggling with this feature of the JSF.

      Suggestions have been to reduce the com.sun.faces.numberOfViewsInSession
      and com.sun.faces.numberOfLogicalViews parameters.

      What I want to know is whether it is possible to instruct JSF (or Seam) to not
      automatically bloat the session with org.ajax4jsf.application.AjaxStateHolders
      for a specific set of pages ... or something similar?

      ... or, how do people deal with this? Do you run Seam/JSF on a high-traffic sites
      or is just a bad choice of framework we've made?

      Thankful for any good suggestions ideas here!


        • 1. Re: Statelessness hard to attain in Seam (or?)
          Tobias Hill Newbie

          Ok, just found out how Christian is using variable session lengths in the wiki example application. That is of course one way to limit the impact of the unneeded session pile-up. Will apply that one while looking for other ways to circumvent JSFs (presumably) misuse of the session altogether.


          Details from the example:

              public void extendSessionTime() {
                  // Store the regular session timeout value, so we can set it back later on logout
                  int regularSessionTimeout = ServletContexts.getInstance().getRequest().getSession().getMaxInactiveInterval();
                  Contexts.getSessionContext().set(REGULAR_SESSION_MAX_INACTIVE_SECONDS, regularSessionTimeout);
                  WikiInit init = (WikiInit)Component.getInstance(WikiInit.class);
                  if (init.getAuthenticatedSessionTimeoutMinutes() != 0) {
                      log.debug("setting timeout of authenticated user session to minutes: " + init.getAuthenticatedSessionTimeoutMinutes());
              public void resetSessionTime() {
                  // Don't rely on that, do a null check - this should never be null but sometimes it is... *sigh*
                  Object o = Contexts.getSessionContext().get(REGULAR_SESSION_MAX_INACTIVE_SECONDS);
                  if (o != null) {
                      int regularSessionTimeout = (Integer) o;
                      log.debug("resetting timeout of user session after logout to minutes: " + regularSessionTimeout/60);
                  } else {
                      // Safety, reset to a low value, 10 minutes

          • 2. Re: Statelessness hard to attain in Seam (or?)
            Francisco Jose Peredo Noguez Master

            I have no experience with this problem, but looking at the string org.ajax4jsf.application.AjaxStateHolder it seems to me that this is a problem may be more related to Ajax4JSF/Richfaces than to Seam...

            Have you tried asking this question in the RichFaces forum? Maybe they know a way to tweak (disable?) this AjaxStateHolder?

            • 3. Re: Statelessness hard to attain in Seam (or?)
              Francisco Jose Peredo Noguez Master

              Is this the same problem you are writing about? RF-3878. If it is... it seems to be that the problem is at the core... in JSF.

              • 4. Re: Statelessness hard to attain in Seam (or?)
                Tobias Hill Newbie

                Yes I saw that issue ... and yes I do believe that it is the very same thing.  

                • 5. Re: Statelessness hard to attain in Seam (or?)
                  gdfgd eqwe Novice


                  I have a same problem! Can you tell me any suggestions for this issue?