This article is reproduced fromArchitect’s way
1、 Static page
Static pages refer to almost unchanged pages in the Internet Architecture (or the change frequency is very low), for example:
- Home page and other HTML pages
- JS / CSS and other style files
- Jpg / APK and other resource files
Static pages are accelerated by matching technical architecture, such as:
2、 Dynamic page
Dynamic pages refer to the pages that different users visit in different scenarios in the Internet architecture, such as:
- Baidu search results page
- Taobao product list page
- Express personal order center page
These pages, different users, different scenarios visit, metropolis dynamically generate different pages.
Dynamic page, with matching technical architecture, for example:
- Hierarchical architecture
- Service Oriented Architecture
- Database, cache architecture
3、 Internet dynamic static separation architecture
The separation of dynamic and static refers to the architecture design method that static pages and dynamic pages are accessed by different systems separately.
- Static pageShort access path, fast access speed, a few milliseconds
- Dynamic pageThe access path is long, the access speed is relatively slow (database access, network transmission, business logic calculation), tens of milliseconds or even hundreds of milliseconds, which requires higher scalability of the architecture
- Static pages and dynamic pages are distinguished by different domain names
4、 Page static
Since the static page access is fast and the dynamic page generation is slow, is it possible to generate the site that originally needs dynamic generation in advance, and use the static page acceleration technology to access it?
This is the core of the Internet architecturePage staticOptimization technology.
For example, as shown in the figure below, the post details page of 58 city originally needs to be generated dynamically:
- The browser sends an HTTP request to visit / detail / 12348888x.shtmlDetails page
- The web server layer parses the post ID from the restful interface12348888
- The service layer is assembled through the Dao layerSQL statement, access database
- Finally, get the data,Assemble HTML and return to browser
“Page static” means that the post 12348888x.shtml with post ID of 12348888 is generated in advance and accelerated by static page related acceleration technology
In this way, it will greatly improve the access speed, reduce the access time and improve the user experience.
5、 Applicable scenarios of page static
Page static optimization speed will be faster, then can all scenarios use this optimization?Which business scenarios are suitable for this architecture optimization scheme?
All architecture design out of business is rogue, page static, suitable for: the total amount of data is small, generate a small number of static pages business. For example:
- 58 Express City page only a few hundred, you can use this optimization, just in advance to generate hundreds of cities “static page”
- Some second-hand car business, only tens of thousands of second-hand car inventory, can also generate these tens of thousands of second-hand car static page in advance
- In the information mode business such as 58 city, there are billions of posts, so it’s not enoughnoToo suitable for static (too many fragmented files, but slow access)
Page staticIt is an optimization technology to generate static sites in advance from sites that need to be generated dynamically.
The total amount of data is small,Generate a small number of static pages, very suitable for “page static” optimization.