Static website page Solution

Source: Internet
Author: User
Tags url forwarding

Http://www.cnblogs.com/wildman/archive/2009/07/28/1533222.html

In
In large websites, the pages that visitors see are basically static pages. Why static pages? There are many benefits for static pages. For example, the access speed is fast, which is more conducive to search engine indexing. Currently
There are two main types of static pages: one is to capture and save dynamic pages as static pages through programs. Such pages actually exist on the server's hard disk, another method is to use the URL rewrite method of the Web server. Its principle is to convert external URL requests to internal file addresses based on certain rules in the internal module of the Web server, in a word, the static address of the external request is converted to the actual dynamic page address, but the static page actually does not exist. Both methods achieve static URL, but they also have their own characteristics.

This method converts a dynamic page to an existing static page. Because of the existence of a static page, the dynamic parsing process is reduced, which improves the access speed and stability of the page, this makes the optimization effect very obvious. Therefore, this method is widely used. However, its limitations also exist. For large websites, this method will bring about problems that cannot be ignored.

1. because a large number of files are generated, storage needs to consider the number of files and folders and disk space;

2. The complexity and workload of page maintenance, as well as the timeliness of page maintenance, require a complete set of site update systems.

The URL rewrite method has the same distinctive features. Because it is the address resolved inside the server, the content is updated in real time, and there is no file management or hardware problem, which makes maintenance easier. The URL rewrite Rewriting Technology at the server level does not affect the page execution speed. However, the threshold for URL rewrite is relatively high, which is not supported by most domestic virtual hosts and directory-level URL rewrite, by traversing the directory reader URL forwarding rules, the page execution speed is greatly reduced.

In addition to capturing dynamic pages and URL rewrite methods, let's look at another method here. The core idea of this method is to divide pages into sub-data blocks. Each data block may be an inc file, or multiple data blocks may be contained in an inc file. The specific data block division is processed according to the service structure of the page. For example, a public data block such as the head and end of a website can be an independent file. The following aspects need to be considered for this method:

1. How to generate pages and data blocks

2. Page Update mechanism;

3. Maintain a large number of page files;

4. Timeliness of page data blocks.

In this way, you can usually add a service program in the background to generate a page for a channel or column. Although this method is feasible, the logic structure is clear Based on the channels.



[Single service mode]

This will cause some problems. For example, after a channel is modified, the corresponding service programs must be repeated. If there are many channels, there will be a lot of corresponding service programs, resulting in a large workload for program maintenance. Front-end developers should not only create pages, but also consider the background service program structure, which increases unnecessary development difficulty and reduces development efficiency.

 


[Multi-service mode]

In the multi-service mode, multiple services compete for command data. The status of the action command must be synchronized between multiple services. If the service is upgraded, update the service one by one. If an error occurs, troubleshoot the problem one by one ......

That
Is there a way to independently abstract the page generation function into a platform and provide a program interface. Front-end developers only need to follow this interface to develop business components. Currently, front-end developers only
You need to deploy the business components in the specified place. The rest is handed over to this platform, which simplifies system release and maintenance, reduces the workload of front-end developers, and improves their
Development efficiency.


[Centralized platform processing mode]

An action instruction is a page update action. When the page data changes, an action is triggered from somewhere according to the business rules. There are roughly three sources: foreground page triggering, background content management system triggering, and background automatic and timed triggering.

Interface Design of the static data generation system and business components. Call business components through reflection. The interface parameters can be expanded based on the instruction structure. For example, add some Error Descriptions and database link objects.

Data distribution is an independent data transmission system that transmits the generated page data to the specified Web Server Based on preset configurations.

In order to make the system horizontally expand as the website traffic increases, the speed of instruction processing is accelerated. Therefore, you need to deploy the system on multiple servers, so that all subsystems must communicate and coordinate in a unified manner. MQ messages can be used as communication means between subsystems. The deployment mode of the subsystem is changed to master-slave. The system on the master host is responsible for reading commands, and then sends the commands to MQ. Each slave host system is responsible for receiving MQ message commands, calling service components, and updating the status of a command. In this way, the average pressure on the Service Logic is allocated to each slave host.


For a large website, there will be a lot of page data generated, and managing these page files is a problem. For example, some pages are deleted, and the generated page data still exists on each web server. In this case, you need to use the background system to record the deployment location of these page files for future unified management. At the same time, there may be a large number of business components, especially in the case of multiple versions, you also need to record the configuration of business components to the database for unified management.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.