Front-end
|
|
We shall start by building a front-end system and determine the purposes and tasks of this tier. NGINX, SQUID, OOPS or other similar product can be used as a front-end server. NGINX is a very compact and fast web (HTTP) server. NGINX consumes just a little memory, is able to serve requests for static files without assistance and can act as an accelerated non-cashing proxy. For example, if an image is requested, NGINX reads data from the disc and transfers the file to a client. SQUID and OOPS are classic proxy servers capable of proxying requests; they usually cache static requests by storing copies of static objects in the cache (or disc for persistent objects) during a certain period of time. We can assert that NGINX showed the best run-time results. However caching proxy servers can also produce good results. In a two-tier architecture, a front-end system is puts forward to a client: a lightweight web or proxy server that receives user requests and executes the requests that can be processed without the back-end assistance. If using NGINX or similar server, all static objects are read directly from the disc and transferred to a client. If a caching proxy server is used, a back-end is queried for static objects, images and style-sheets only once. Afterwards, these files are stored in the front-end cache according to the cache policy and transferred to clients without querying the back-end. The main goals we attempt to achieve by creating a front-end tier are:
As you can see, the front-end allows to eliminate quite a few risks and attain the most favorable conditions for the system. Note! If you intend to use a caching proxy server as a front-end, configure the caching time of documents. Images, style-sheets, XML files and other static objects are subjects of the caching policy. After the first request, files are stored in the proxy server and are transferred to clients without querying the back-end. The recommended image caching time is 3 to 5 days. The following code shows an example of the cache configuration that can be specifies in the .htaccess file of the server root: ExpiresActive on ExpiresByType image/jpeg "access plus 3 day" ExpiresByType image/gif "access plus 3 day" This example requires that a web server allows redefinition of variables in .htaccess, and the "mod_expires" module is installed. In some cases, the front-end caching policy is configured independently of the back-end configuration. These directives instruct the front-end to cache all images. Queries for the content pages will not be cached and will be directed to the back-end. Pass self-check test A two-tier configuration: Front-End and Back-End | Mô tả khóa học | Interaction with Back-end |