You have to tweak your config in the A4D_NTKConfig list.

The old server code had a broken implementation of keep-alive which never 
actually waited for subsequent requests on the same thread. So each thread 
served a single request and immediately became available.

The new implementation waits for the number of seconds specified in 
KeepAliveTimeout, which defaults to 5, before it becomes available to serve 
another request. So once you reach MaxThreads, each new request could 
potentially wait up to 5 seconds to be served. Thus if you then continue to get 
new requests at a rate > KeepAliveTimeout per second, the server slows to a 
crawl.

Note that this is not a deficiency in the design of the server; apache also 
waits 5 seconds per thread by default and thus has the same problem, but its 
limit is much higher. Once it reaches that limit it slows to a crawl, and 
that’s what a denial of service attack intentionally tries to do.

So the solution is to increase MaxThreads to a much higher number. This can be 
arbitrarily large as long as you have lots of memory available. You could tweak 
ThreadStack accordingly. Currently there is no code to reclaim threads after a 
period of inactivity.

All the best,

  - Aparajita

> Since 4D continues to run fine I suspected that we are getting into a 
> situation where the Active4D/NTK server exhausts all of its threads. In other 
> words it has started the max thread count, and those threads exist, but are 
> in a state where they are not available. What I don't know is why that would 
> happen.
> 
> By running some very heavy tests with Apache Bench, I could repeatedly see 
> the allocation of new threads up until the point where 
> <>A4D_ThreadPool_ThreadIDs) = <>A4D_ThreadPool_MaxThreads.
> At that point our system become unresponsive. While these heavy test were 
> running our Active4D pages were responsive for me. The logs also didn't show 
> any errors. 
> 
> In my case I could always kill the server if I entered an ab concurrency 
> value that was higher than the <>A4D_ThreadPool_MaxThreads which is 27 in our 
> case. 30 would kill it.
> 
> Do you have any ideas?


_______________________________________________
Active4D-dev mailing list
[email protected]
http://list.aparajitaworld.com/listinfo/active4d-dev
Archives: http://active4d-nabble.aparajitaworld.com/

Reply via email to