Views: 1140 (Data available since 06.02.2017)
Last Modified: 10.10.2012
Another aspect is the problem of slow client Internet channels, compared to the web server processing power. At first sight, this problem is not of the utmost importance. However, it can be a reason of many problems.
For example, page generation can take 0.01 sec, while the page transfer time from the server to a client can be 5 to 50 sec and more, even with compression.
While transferring a page to a client, a web server keeps an almost inactive Apache process in memory waiting for the data transfer completion unable to release itself and the memory to start processing incoming queries.
Administrators often do not realize how this factor influences the system stability and the memory use.
Let’s make a simple calculation. Consider the two systems: A and B.
In the "A" system, the page creation time is 0.1 sec, and the average page transfer time is 5 sec (in the real life, this value can be higher). In the "B" system, the page creation time is 0.1 sec, and the page transfer time is zero.
Assume each site receives 100 queries per second.
The "A" system: processing 100 queries per second will require running 100 simultaneous individual web server processes. You may ask: "Why?" Because even if a query is processed within 0.1 sec, it turns out that our processes are not yet ready to handle other requests, and they sit in memory and are just wait for current clients to receive the page (5 sec). By the fourth second, the web server receives 100 more queries and has to start 100 more processes. Consequently, by the fifth second there will be 500 processes in memory and only from this moment on the processes of the first second will begin to terminate and free memory to process new queries. Hence, the "A" system requires running about 500 processes for adequate performance, which will require about 10 GB of memory at best. Note that even if the page generation time is 0.001 sec, it would not help to improve the system performance, because the processes wait for the period which is the duration of transfer of data to clients on slow channels rather than the page generation time. This means that the "A" system performance is not related to the performance of PHP or the system.
The "B" system: a web server receives 100 requests within the first second. Only 10 processes are required to handle 100 requests. One process processes one query for 0.1 sec. As we have assumed above, the time required to transfer a page to a client is null. That is, one web server process is able to handle 10 user queries per second. By the end of the first second, all requests will be processed by only 10 processes, and by the second 2 all the processes will be ready to process the queued requests. The same situation will occur on the second 3, and in an hour. Hence, only 10 processes are required for the adequate performance of the "B" system, which takes only 200 MB of memory. It should be emphasized that reducing the page generation time to 0.01 sec allows to dramatically increase the system performance because only one process will process 100 requests per second. The "B" system performance depends solely on the performance of PHP rather than slow channels.
This story clearly illustrates the negative influence of the slow client channels on the overall web system performance. The web servers consume memory ineffectively on slow channels.
Running a few steps forward, we should mention that the techniques exist allowing to build a system close to the "B" model and make a web system independent on slow channels dramatically increasing the system performance and stability.