I understand that it’s considered bad design to use a normal, threaded webserver (e.g., Apache) for AJAX long polling…but I don’t really understand why.
Is it because each longpolling request takes significantly more time than a normal one would (thus tying up the processor)? And if that’s the case, do threads really take that much overhead that they cannot remain idle for awhile before use?
Just to clarify, AJAX polling is when client-side javascript makes an AJAX request that isn’t fulfilled immediately. Instead, the server waits until it wants to push a reply to the client and then uses the already-open AJAX context to do so. (right?)
On a web server that handles each connection its own thread, that open connection is going to cause one thread to be created for each client on the web site. The thread will stay running until the client closes the connection. When I say “running”, that just means that the thread exists and is taking up server resources; it could be idling in a sleep() or wait() function. But it still consumes far more system resources than would be used in an event-based server.