“This article has participated in the good Article call order campaign, click to view:Back end, big front end double track submission, 20,000 yuan prize pool for you to challenge!”
preface
Recently in the large-scale transformation of SSR page, so the SSR technology has a certain technical understanding, thinking of writing an article to summarize the preliminary understanding of SSR. This is a product manager friendly introductory article, specific implementation technology article in the back (mainly is our product manager want to learn ah, do not write may be killed dog head) PS occasionally downstairs to see the weather, really good look, like P out of the screensaver
directory
- What is the SSR
- What does SSR achieve
- What kind of business does SSR fit into
- How can SSR be achieved
The body of the
What is SSR
- Server rendering, is to put the front page on the server first run out a result, and then to the user, the user can directly see the page.
1. What does SSR achieve
- Result: Reduce the viewing time of the first screen straight out to increase user reachability, and in some specific scenarios can improve SEO ability, thereby improving other business indicators.
- Process: The HTML is rendered on the server and returned to the client after rendering. The client receives THE HTML directly for rendering, thus reducing the rendering time on the Web side of the user
- Disadvantages: It may increase the pressure on the server, but this pressure can be avoided in certain scenarios, or even reduce the pressure on the server
- Many people think that the biggest pain point solved by SSR is SEO, but we have a lot of scenes that do not rely on search, such as the goods inside the APP, in this case, SSR scene solves the problem of first screen arrival rate
2. What kind of business is SSR suitable for
- Technology is all about serving the business, so it’s important to understand what kind of business a technology is for to promote the target service
- SSR is divided into static page rendering and subsequent dynamic rendering, so it is suitable for pages with strong SEO requirements. Static page rendering is used to improve SEO level
- SSR is also suitable for pages that require users to receive information quickly in order to attract users. For example, a super attractive page such as “Full 1, 10, 000” needs to be displayed quickly in order to hit the user’s heart and retain the user to accept the next message
- SSR if you want to reduce the pressure on the server, it is necessary for the user is the same page, or for the user needs to quickly know the first screen information and then willing to receive page refresh business
3. How to achieve SSR
-
- The first is on the server side, where someone needs to deploy a middleware program that handles page rendering at the top and bottom of the page, mostly using Node
-
- Mobile pages need to support SSR modifications, and some special variables may not exist in the Node environment
-
- To reduce server stress, you need to add page caches on additional servers, so that a request does not require rendering and data requests, thus not stressing the server.
The cache before
Server ->> User: No, I have to calculate it and then render it. User -) Server: You look so stressed
After the cache
SequenceDiagram User ->> Server: Do you have a page cache server ->> User: Yes, I asked CDN for your server ->>CDN: give it to him ->> User: The page is coming
Afterword.
Write about the SSR operation logic and business adaptation and simplified simplified version of the principle, should be written in the back of three to explore the principle of SSR and SSR implementation of the step on the pit and solutions, hope to get your support ~