0

我们正在使用 mta 来构建由多个微服务组成的应用程序。

之前我们使用 CF CLI 将微服务部署到 SAP Cloud Foundry,但最近切换到 SAP Cloud SDK Pipeline 以使用蓝绿模式进行部署。

其中一项微服务基于 Nodejs。如果我们使用 CF CLI 部署 nodejs 微服务,它只需要 2 GB 的内存分配。应用程序被部署没有任何问题。

但是,对于上述相同的应用程序,如果我们切换到 SAP Cloud SDK Pipeline 进行蓝绿部署,2 GB 并不总是足够的。由于内存不足问题,并非每次但间歇性地应用程序部署失败。我们甚至尝试将分配的内存增加到 4 GB,但由于上述问题,它仍然间歇性地失败。

我们不确定,但看起来上述内存泄漏是由于 SAP Cloud SDK Pipeline 的蓝绿部署模式造成的。
感谢有人可以在这里帮助我们解决这个内存泄漏问题。请在日志下方找到。

 [STG/0] OUT npm ERR! code ELIFECYCLE
 [STG/0] OUT npm ERR! errno 137
 [STG/0] OUT npm ERR! testapp@0.0.0 build-prod: `ng build`
 [STG/0] OUT npm ERR! Exit status 137
 [STG/0] OUT npm ERR! 
 [STG/0] OUT npm ERR! Failed at the testapp@0.0.0 build-prod script.
 [STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 [STG/0] OUT npm ERR! A complete log of this run can be found in:
 [STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_756Z-debug.log
 [STG/0] OUT npm ERR! code ELIFECYCLE
 [STG/0] OUT npm ERR! errno 137
 [STG/0] OUT npm ERR! testapp@0.0.0 ci-build: `npm run build-prod`
 [STG/0] OUT npm ERR! Exit status 137
 [STG/0] OUT npm ERR! 
 [STG/0] OUT npm ERR! Failed at the testapp@0.0.0 ci-build script.
 [STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 [STG/0] OUT npm ERR! A complete log of this run can be found in:
 [STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_772Z-debug.log
 [STG/0] OUT npm ERR! code ELIFECYCLE
 [STG/0] OUT npm ERR! errno 137
 [STG/0] OUT npm ERR! testapp@0.0.0 postinstall: `npm run ci-build`
 [STG/0] OUT npm ERR! Exit status 137
 [STG/0] OUT npm ERR! 
 [STG/0] OUT npm ERR! Failed at the testapp@0.0.0 postinstall script.
 [STG/0] OUT npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
 [STG/0] OUT npm ERR! A complete log of this run can be found in:
 [STG/0] OUT npm ERR!     /home/vcap/.npm/_logs/2020-05-15T20_04_25_807Z-debug.log
 [STG/0] OUT        [31;1m**ERROR**[0m Unable to build dependencies: exit status 137
 [STG/0] ERR Failed to compile droplet: Failed to run all supply scripts: exit status 14
 [STG/0] OUT Exit status 223 (out of memory)
4

1 回答 1

1

我首先建议不要注册ci-build为安装后脚本。这不应该是必需的。npm run ci-build管道将在 之后自动调用npm install。我认为使用您当前的配置,它甚至在构建阶段执行了两次。

由于 cf 部署也执行npm install,因此ci-build将被触发,这不应该是必需的,因为它之前已经执行过。

于 2020-06-26T07:12:08.713 回答