Views: 1619 (Data available since 06.02.2017)
Last Modified: 10.10.2012
A Back-End is a common Apache web server capable of running PHP applications.
The back-end still can execute queries for images and static files if the front-end uses a caching proxy server. But it is very important to minimize the number of queries to the back-end server for static files ensuring that 99% of all queries are PHP pages. Remember that the use of back-end to process static queries is extremely resource and time expensive.
When configuring the back-end, you can get a significant performance gain and stabilize memory consumption.
In most cases, a back-end is a common Apache web server on a non-standard port (e.g. 88) responding only to queries from localhost or the front-end IP address.
Administrators should use more than one internal IP addresses like 127.0.0.2, 127.0.0.3 etc. on the port 80; otherwise, undesirable redirects to an invalid port of the front-end server may occur.
Let us outline the process of interaction between the front-end and the back-end when processing a user request for a common page.
Assume that a front-end accepts a user request, for example, at http://www.bitrixsoft.com on the port 80. We use NGINX as a front-end on our site. The query is accepted and relayed to a back-end (PHP-enabled Apache web server), which processes all queries at http://127.0.0.2:80/. The back-end web server executes the query by processing a PHP script and generating an HTML page to be sent to a client. The prepared HTML page is transferred then form the back-end to the front-end as a response to the user’s query; a connection between the front-end and the back-end closes (avoid using KeepAlive at the back-end); and the back-end process frees the memory or starts processing another query. The front-end transfers the ready page to the client for as long as required, even on a slow channel. Transferring the page to the client requires minimum of the front-end memory. Having received the page, the client browser sends a series of requests for images and style-sheets. All requests are received and processed by the front-end without troubling the back-end. The front-end reads all the static files directly from the disc without using the slow and expensive back-end processes.
As practice shows, the two-tier Front-End + Back-End configuration reduces memory consumption to a minimum as well as the time required for request processing, and allows to give the database more memory for better performance. This configuration reduces server load significantly when processing a large amount of static files: music, software installation packages, presentations etc.