SAP Spartacus 服务器端渲染处理内存泄漏的准则
開(kāi)啟服務(wù)器端渲染(SSR) 的 SAP Spartacus 實(shí)例,運(yùn)行在 CCV2 Pod 里,當(dāng)下列情況出現(xiàn)時(shí),可能會(huì)造成 pod 的重啟:
resource allocation for SSR container within JSAPPS storefront pod is not sufficient and is causing finally some restarts.
比如:
過(guò)去3天內(nèi),運(yùn)行在 SSR 模式的 Spartacus 所在的 pod,有 178 個(gè) restart 事件:
SSR pods will be restarted at the memory consuming at 65% ~70%.
SAP Spartacus 3.0 對(duì)服務(wù)器端渲染模式下內(nèi)存參數(shù)的優(yōu)化:
In version 3.0, it’s possible to optimize SSR in relation to the max-memory-restart parameter, without having to increase the memory further.
In general, even 2-3 GB of memory is usually enough for SSR.
Spartacus 3.0 做的關(guān)于 SSR 的優(yōu)化:
https://sap.github.io/spartacus-docs/server-side-rendering-optimization/#enabling-the-ssr-optimization-engine
MAX thresholds for JSStoreFront SSR PODs
具體優(yōu)化內(nèi)容如下:
注意:CSR renders should never be cached. 相反的,渲染好的 SSR 頁(yè)面必須被緩存(例如使用CDN). 這樣,確保接下來(lái)的請(qǐng)求不會(huì)給 SSR 服務(wù)器造成負(fù)載。
所有這些優(yōu)化操作,減小了 SSR 服務(wù)器的負(fù)載,以及 fallback 到 CSR 的次數(shù)。
啟用 SAP Spartacus 3.0 SSR Optimization Engine 的源代碼:
https://sap.github.io/spartacus-docs/server-side-rendering-optimization
import { ngExpressEngine as engine } from '@nguniversal/express-engine'; import { NgExpressEngineDecorator } from '@spartacus/setup/ssr';[...]const ngExpressEngine = NgExpressEngineDecorator.get(engine);[...]// In the app() functionserver.engine('html',ngExpressEngine({bootstrap: AppServerModule,}) );總結(jié)
以上是生活随笔為你收集整理的SAP Spartacus 服务器端渲染处理内存泄漏的准则的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
 
                            
                        - 上一篇: arm-linux-gcc编译器定义寄存
- 下一篇: 10款英文字体推荐(转)
