Saturday, July 16, 2011

ADF View State Tuning for Large WebCenter 11g PS3/PS4 Applications

While running large ADF/WebCenter 11g PS3/PS4 applications in stress test or production environment, users can experience random errors related to ADF view state token. For example such errors can be observed in the log: StateManagerImpl restoreView Could not find saved view state for token -ejrgnqgsv.

We can refer to section 8.2 Oracle ADF View Performance from Oracle Fusion Middleware Performance and Tuning Guide. It describes org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS property and instructs how to tune performance by reducing the size of state token cache. By default, for ADF application tokens size is set to 15 (I personally would recommend to set it to 25 and then measure application performance, if no performance issues, its better to keep available tokens value higher), it can be tuned to 2. When it is set to 1, ADF application will return error after browser Back button click. When we create new WebCenter application in JDeveloper, org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS is set to 3, this means WebCenter application would keep only three tokens in memory. Number of tokens is set to 3, probably to reduce memory usage for heavy WebCenter applications.


We have noticed, when Web session timeout is set to default 30 minutes, after 10-15 minutes of user inactivity - could not find saved view state for token error is be reported randomly. This is unexpected behavior, because user is not pressing browser Back button, but still gets error during inactivity, even before timeout.

This means org.apache.myfaces.trinidad.CLIENT_STATE_MAX_TOKENS = 3, as it set for WebCenter 11g PS3/PS4 applications, looks like not enough. When this value was increased to 25, state token error was not reproduced anymore.

Hope this hint will help you, in case of unexpected error will be encountered for missing view state during user inactivity.

11 comments:

Anonymous said...

Note that setting this parameter to a higher value means that you are likely going to see bigger memory consumption on the JSF server per user.

Andrejus Baranovskis said...

Yes, its why I recommend to see how it affects performance and tune accordingly for each application.

But the fact is, with default value 3 for WebCenter, its not working consistent for larger WebCenter apps.

Andrejus

Achinto Banerjee said...

We also facing similar problem where the page just kept on refreshing itself in clustered env and only in IE . In mozila page will come up fine . Also , when we bypassed security stack we are using and used adf security instead the pages seemed to be working fine .
But in either case when we increased the tokens to 25 the problem could not be reproduced.
So for now we are going with increased value of 25 , but just wondering what could be an ideal value for it . Should we look to increase it further .

Thanks,

Achinto Banerjee

Andrejus Baranovskis said...

You should not increase it further, unless same issue will be reproduced again. This value highly depends on how many regions your applications is using. If its not reproduced, highly possible that 25 is good enough.

Andrejus

Baduel said...

Hi Andrejus. Very good post. I've exactly the same problem with my web application but with the value 25 the problem still occurs.

What is the next value to try? Depending on what I have to decide the correct value?

Thank you.

Anonymous said...

Andrejus,

I am facing weird behavior on my web center portal application. Basically, I have main ADF taskflow that has one veiw--> calling taskflow. inside called taskflow i have view that contains panelbox. I am setting disclosed property to false to collapsed panelbox by default. When I reenter to Called taskflow again I see the panelbox open again instead of collapse in my portal application. I have deployed this ADF taskflow as shared lib on portal application.

It works in my stand along application. For some reason my component state is saved when it runs with portal framwork.

Ishaan & Ajay Barve said...

Hello Andrejus,
We had CLIENT_STATE_MAX_TOKENS =1 and we are getting ramdom error on the portal & the error messageis a Java script popup that says 'A connection to the server has failed’. After reading your whitepaper I increased the value to 15 and I still get the error.Do you know if this error is because of CLIENT_STATE_MAX_TOKENS?

Andrejus Baranovskis said...

'A connection to the server has failed’ - is a different error, not related to the tokens. We have solved it in out projects, this was related to tuning ADF for poor network connections. Tuning is quite complex, we could help you - send me email offline.

Regards,
Andrejus

Siu Fai Ng said...

Hi Andrejus,

Our project is also facing the issue "A connection to server has failed".
Any suggestion ?
Or may I drop an email to you ?

Thanks.

Tony

Andrejus Baranovskis said...

Hi Tony,

Yes, please send the email.

Andrejus

Peter Fajemisin said...

Hi Andrejus,

We are also facing "A connection to server has failed", Any wuick suggestions or can I send you an email?