更新时间:2022-09-06 08:46:01
https://sap.github.io/spartacus-docs/server-side-rendering-optimization/
为什么要引入服务器端渲染优化?
Without s-s-r optimization, it is possible for the following to occur:
Pages do not render quickly enough, which leads to s-s-r using too much memory, and eventually it fails.
如果页面渲染不够快,可能会导致 s-s-r 使用了太多内存,最终导致渲染失败;
A response is not received in time, and an HTTP 500 error is returned.
无法按时接收到响应,只得返回 HTTP 500 错误给客户端。
s-s-r 优化引擎的参数
timeout
a number that indicates the amount of time (in milliseconds) during which the s-s-r server tries to render a page, before falling back to CSR.
该配置的单位是毫秒,代表 s-s-r 服务器在退化到使用客户端渲染之前,能够消耗用于渲染页面的时间。如果过了这个时间间隔,还未完成服务器端渲染,则返回 CSR 的 index.html 给客户端。该 index.html 不包含任何渲染好的 markup.