One minute understanding of Internet dynamic static separation architecture

Time:2021-3-6

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

img

Static pages are accelerated by matching technical architecture, such as:

  • CDN
  • nginx
  • squid/varnish

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.

img

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.

img

Generally speaking:

  • 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:

img

  • 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

img

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)

6、 Summary

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.

Recommended Today

Third party calls wechat payment interface

Step one: preparation 1. Wechat payment interface can only be called if the developer qualification has been authenticated on wechat open platform, so the first thing is to authenticate. It’s very simple, but wechat will charge 300 yuan for audit 2. Set payment directory Login wechat payment merchant platform( pay.weixin.qq . com) — > Product […]