I am working with ASP.NET. IMHO, support for asynchronous programming in ASP.NET is wonderful. That is, we can have a BeginXXXX / EndXXXX pair method to increase scalability for a demanding task.
For example, one operation should receive huge data from the database and display it on the response web page. If this operation is synchronous. The thread passing this request will be busy for the entire life cycle of the page. Since threads are limited resources, it is always best to work with I / O in asynchronous mode. That is, ASP.NET will allocate a thread to call the BeginXXXX method with a callback function. The thread calls BeginXXXX immediately returns and can be arranged to handle other requests. When the job runs, the callback function starts and ASP.NET will call EndXXXX to receive a response.
This asynchronous programming model can make full use of streaming resources. Although there is a ThreadPool limitation, it can handle many more requests. However, if we program synchronously, and long-term I / O is required for each request, simultaneous requests will not exceed the size of the thread pool.
Recently, I have a chance to learn another web development solution, such as PHP and Ruby on Rails. To my surprise, these solutions have no analogue to the asynchronous programming model. Each request is processed by one thread or process for the entire life cycle. That is, the thread or process is busy until the last bit of the response is sent.
There is something similar to asynchronous ( http://netevil.org/blog/2005/may/guru-multiplexing ), but the baseline is that there is always one thread or process busy for the request. This is not like ASP. NET
So I am wondering: why is there no asynchronous programming model like ASP.NET in this popular web solution? Why is only ASP.NET developing to use the asynchronous approach?
Is it because PHP and Ruby-on-Rails are mostly deployed on Linux? And Linux does not suffer from a decrease in process / thread performance, like Microsoft Windows?
Or, is there really an asynchronous solution for PHP and Ruby-on-Rails that I have not found?
Thanks.