For example, Stackoverflow most likely uses a server-side rendering approach. There are far two many questions for it to rebuild static versions of every question page each time a new post is submitted. The data also needs to be very real-time with users being able to see posts submitted only seconds ago.
However, a blog site, or promo site, which hardly has any content changes, would benefit much more from a static site setup. The response time would be much greater and the server costs would be much lower.
服务器端渲染是从客户端/浏览器向服务器发出请求的地方,然后在运行时生成HTML,并将其发送回浏览器进行渲染。
静态站点渲染非常相似,但是解析是在构建时执行的。因此,在发出请求时,HTML会静态存储,并且可以直接发送回客户端。
他们都有优点和缺点:
尽管由于不需要服务器端处理,所以静态站点在运行时会更快,但这确实意味着对数据的任何更改都需要在应用程序服务器端进行完全重建。
或者,通过服务器端方法,将所有缓存放在一边,即可实时处理数据并直接发送给客户端。
通常,最好根据内容的动态性和实时性以及应用程序的性能来做出最佳决定。
For example, Stackoverflow most likely uses a server-side rendering approach. There are far two many questions for it to rebuild static versions of every question page each time a new post is submitted. The data also needs to be very real-time with users being able to see posts submitted only seconds ago.
However, a blog site, or promo site, which hardly has any content changes, would benefit much more from a static site setup. The response time would be much greater and the server costs would be much lower.