Dynamic publishing Site concurrent access to upgrade

zhaozj2021-02-12  132

Question: ASP / PHP and other dynamic buildings often have a large number of websites that have a large number of websites, where is the problem? Usually the website has a news section, assuming a website news section is built in the / news / directory, usually there is an item.asp? Id = 1234 displaying a record, the user has access to a connection, often calling this dynamic script file, Turn on the database connection to find a record. . . Wait a series of actions. It's no problem, 100, 1000 questions, causing the server pressure to increase.

But in fact, because the ID is 1234 article, the content has been determined, so basically A user access to the same action when accessing to b users, but the content is the same, but there is N times database open reading action. In general, database operations belong to the operation of high consumption system resources.

Idea: I know this reason, we can read a database, then store the read content as a static page, and later access to this static page. This is the basic measures to improve sites concurrently. A normal PC server handles static page access, one day can reach 700W this request. However, there may be many sites that have been designed to be a dynamic building consideration, so including connectivity, navigation, etc. depend on dynamic mode, all modified to Sina, Sohu, etc., the static release mode is inappropriate, so it is necessary to do not change the overall site access structure. Conduct adjustment.

Specific scenario: ASP program such as /item.asp?id=1234 is modified: 1, copy a such file, assume it named Item_bak.asp 2, make the content.asp code to do the following modification: ID = Request ("ID") TXTFILE = "Item_" CSTR (ID) ". htm" ifeexist (txtfile) THEN ELSE GENHTML (TXTFILE, "ITEM_BAK.ASP? ID =" CSTR (ID) End if Response .Redirect txtfile response.end where the function fileExist is to determine if the TXTFILE file exists on the server, the function genhtml uses the XMLHTTP server-side components to read the HTML content of the item_bak.asp? id = 1234 files after writing the current directory on the server. .

In this way, each article will only read the database once, and then all access is directed to a static HTML file to mitigate the server pressure.

Summary: The only shortcomings will increase hard disk space requirements. But basically will not cause confusion, strictly abide out.

转载请注明原文地址:https://www.9cbs.com/read-6339.html

New Post(0)