天天看點

SAP Spartacus 3.3.0 版本伺服器端渲染的優化

https://sap.github.io/spartacus-docs/server-side-rendering-optimization/

為什麼要引入伺服器端渲染優化?

Without SSR optimization, it is possible for the following to occur:

Pages do not render quickly enough, which leads to SSR using too much memory, and eventually it fails.

如果頁面渲染不夠快,可能會導緻 SSR 使用了太多記憶體,最終導緻渲染失敗;

A response is not received in time, and an HTTP 500 error is returned.

無法按時接收到響應,隻得傳回 HTTP 500 錯誤給用戶端。

SAP Spartacus 3.3.0 版本伺服器端渲染的優化
SAP Spartacus 3.3.0 版本伺服器端渲染的優化

SSR 優化引擎的參數

timeout

a number that indicates the amount of time (in milliseconds) during which the SSR server tries to render a page, before falling back to CSR.

該配置的機關是毫秒,代表 SSR 伺服器在退化到使用用戶端渲染之前,能夠消耗用于渲染頁面的時間。如果過了這個時間間隔,還未完成伺服器端渲染,則傳回 CSR 的 index.html 給用戶端。該 index.html 不包含任何渲染好的 markup.

SAP Spartacus 3.3.0 版本伺服器端渲染的優化

繼續閱讀