views:

224

answers:

2

In the Seam Reference Guide, one can find this paragraph:

We can set a sensible default for the concurrent request timeout (in ms) in components.xml:

<core:manager concurrent-request-timeout="500" />

However, we found that 500 ms is not nearly enough time for most of the cases we had to deal with, especially with the severe restriction seam places on conversation access.

In our application we have a combination of page scoped ajax requests (triggered by various user actions), some global scoped polling notification logic (part of the header, so included in every page) and regular links that invoke actions and/or navigate to other pages.

Therefore, we get the dreaded concurrent access to conversation exception way too often, even without any significant load on the site.

After researching the options for quite a bit, we ended up bumping this value to several seconds (we're debating whether to bump it up to 10s), as none of the recommended solutions seemed able to solve our issue completely (even forcing a global queue for all the ajax requests would still leave us exposed to a user deciding to click a link right when one of our polling calls was in progress). And we'd much rather have the users wait for a second or two instead of getting an error page just because they clicked a link at the wrong moment.

And now to the question: is there something obvious we're missing (like a way to allow concurrent access to conversations and taking care of the needed locking ourselves, for instance :)? How do people solve this problem (ajax requests mixed with user driven interaction) in seam? Disabling all the links on the page while ajax requests are in progress (as suggested by one blog page) is really not a viable option.

Any other suggestions?

TIA, Andrei

A: 

Can you analyse which types of request are taking a long time? Is there a particular type which you could reduce the request time by doing the "work" asynchronously and getting the update back in your poll?

In my opinion, ajax requests should always complete fairly quickly, then you can calculate a max concurrent request time by (request time * max number of requests likely to be initiated)

bravocharlie
The repetitive ajax requests do complete fairly quickly. However, it's the regular user actions that can take longer (1-2 seconds, or even more, sometimes), and that can be triggered at any time (or an ajax request can be triggered while the user's request is still in progress). We also have a lot of validation or user assisting logic (like completion assistance) implemented using ajax, and I really don't think a polling approach is feasible in those cases.
Andrei
It seems like most of your requests need to be in the conversation then, so bump up your timeout, and optimise optimise optimise!Do you have very large views, i.e. large view state being transmitted backwards and forwards? We recently had to split up an ajaxified tab panel in to separate views to reduce the size of the view state.Have you done the usual optimisation - e.g. outjecting variables, @BypassInterceptors, considered state saving, etc?
bravocharlie
+1  A: 

This is what we have and it works fine for us:

<core:manager concurrent-request-timeout="5000"
    conversation-timeout="120000" conversation-id-parameter="cid"
    parent-conversation-id-parameter="pid" />
Shervin
Thanks. This seems to support our conclusion that bumping the timeout to a higher value is the only practical workaround for this concurrent access to conversations restriction.
Andrei
@Andrei: I am not saying my answer is the correct one. However, if you wish to accept an answer, you should push the green tick under downvote button.
Shervin