On Nov 22, 2007, at 1:06 AM, ute Hoffmann wrote:
Hallo,
every once in a while I have the situation where a single instance
has about 2000+ active sessions and thus becomes unresponsive.
Wow. I'll bet it does!
The user sees "the request produced an error" page.
Question a) Is there a programmatic/javaMonitor way to check how
many sessions are on a single instance and if sessioncount>x set
this session to refuse new sessions till sessioncount<x?
Of course, it's WebObjects. :-) Here is one way. In Application:
public WOSession createSessionForRequest(WORequest aRequest) (
WOSession session = super.createSessionForRequest(Request);
refuseNewSessions(activeSessionsCount() > 200);
return session;
}
Now this might cause problems with scheduling if users have
bookmarked direct actions to this instance. You might want to do this:
private boolean didStartRefusingNewSessions = false;
public WOSession createSessionForRequest(WORequest aRequest) (
WOSession session = super.createSessionForRequest(Request);
if (didStartRefusingNewSessions && activeSessionsCount() < 200) {
didStartRefusingNewSessions = false;
refuseNewSessions(false);
}
if (activeSessionsCount() > 200) {
didStartRefusingNewSessions = true;
refuseNewSessions(true);
}
return session;
}
You could also do this in dispatchRequest before dispatching the
request, strip the instance number from the URL and redirect it (only
works for sessionless direct actions).
Question b) Is there a way to make the instance aware of the
situation and either let it see that it is dead (what it really is)
-> thus restartig itself or sending a mail to an administrator
saying: too many sessions (who then can act accordingly)?
Sometimes you can catch the OutOfMemory exception and call terminate
() on the application. At other times, OutOfMemory is insane.
I could schedule all instances, but I doubt it would solve this
problem because the instance is unresponsive and it probably will
not time out the sessions and thus never be restarted by the
scheduler, right?
Right.
Any solutions for this?
Several. :-)
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-deploy mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-deploy/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]