问题描述
使用App Service for Linux/Container时,从Docker的日志中,我们可以看见有 warmup 行为,而此行为默认时间为230秒,如果超出了这个时间,就会导致Container启动失败。
那么如果代码或Container启动耗时大于了230秒,启动失败,是否又办法来延长这个启动时长限制呢?
问题解答
有的。根据博文(Things You Should Know: Web Apps and Linux)中关于“If your container takes a long time to start, increase the start time limit.”描述:
If your container takes a long time to start, increase the start time limit.
When we start your container, we'll wait a while for it to start and initialize. We consider the startup to be successful once the container is running and once we get a response to a ping so that we know it's ready to respond to HTTP traffic. We'll wait 230 seconds for that to happen. If we don't have a successful start within 230 seconds, we'll assume there's a problem and we'll stop the container.
We realize that some containers might need more time than that to start, so we allow you to increase that 230 second wait time up to a limit of 1800 seconds. To configure that, add an app setting called WEBSITES_CONTAINER_START_TIME_LIMIT and set it to the number of seconds you would like for us to wait for your container to start (up to a maximum of 1800)
所以只要在App Service的配置页面,添加 **WEBSITES_CONTAINER_START_TIME_LIMIT **参数,可以设置它的最大值达到30分钟(1800秒)。
参考资料
If your container takes a long time to start, increase the start time limit.: https://techcommunity.microsoft.com/t5/apps-on-azure-blog/things-you-should-know-web-apps-and-linux/ba-p/392472#ContainerStart
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
分类: 【Azure 应用服务】
标签: App Service, App Service for Container, App Service for Linux, WEBSITES_CONTAINER_START_TIME_LIMIT, warmup 230秒