I thought I had the answer when i found this answer to pausing new activity if the server is too busy...
=======From Bruce ============
a) create a global mem variable, a LONG, unthreaded, called say ThreadsCount
b) In WebHandler, before the line;
p_web.ProcessRequest(p_ReqString)
add
p_web._wait()
ThreadsCount += 1
p_web._release()
and after the call to
p_web.ProcessRequest(p_ReqString)
put
p_web._wait()
ThreadsCount -= 1
p_web._release()
c) In WebServer procedure, StartNewThread method, after loc:RequestData :=: p_RequestData
If ThreadsCount >= x
self.MakeErrorPage(500,'Server Busy','Server Busy, try again shortly')
Return
End
The value you use for x will depend on the memory usage of each thread. And the only real way to know how high it can go is to monitor the value under load, and see at what point the server dies.
As a debugging tool you could write out the value to DebugView, or perhaps write it away to an Ini file or something here.
Cheers
Bruce
=================================
The thread count part seems to work alright, but responding to it from the StartNewThread method doesn't seem to work.
Mostly, I think, because MakeErrorPage returns a string (the error page) and StartNewThread doesn't. So what happens to the error page?
In my test, it just hangs the server.
Is there a more correct place to put this? Shouldn't it be in the WebHandler somewhere?
Thanks
Chris