[英]How Cloud Run behaves with things that are running in my application during the deploy of a new service revision?
I'm migrating a PHP web application that currently runs on Compute Engine to Cloud Run.我正在将当前在 Compute Engine 上运行的 PHP web 应用程序迁移到 Cloud Run。 Currently, this platform schedules the execution of some PHP scripts in the form of cron jobs.目前,该平台以cron作业的形式调度部分PHP脚本的执行。
Let's say that I plan to use Cloud Scheduler to schedule requests to some of these PHP scripts after migrating to Cloud Run.假设我计划在迁移到 Cloud Run 后使用 Cloud Scheduler 来安排对其中一些 PHP 脚本的请求。 My question is related to how Cloud Run will behave if any of these PHP scripts happen to be running during the end of a new deploy of a new service revision, would the deploy of a new revision kill the script execution (triggered by Cloud Scheduler request) in progress?我的问题与 Cloud Run 的行为有关,如果这些 PHP 脚本在新服务修订版的新部署结束期间碰巧正在运行,新修订版的部署是否会终止脚本执行(由 Cloud Scheduler 请求触发) 进行中?
Also, I would like to know how Cloud Run behaves with (any) requests in progress during a new service revision deploy.此外,我想知道 Cloud Run 在新服务修订部署期间如何处理正在进行的(任何)请求。 Maybe both of my questions are related/connected.也许我的两个问题都是相关/相关的。
(Maybe I am wrong when I think that the deploy of a new revision will immediately kill everything running and every request in progress to the service.) (当我认为部署新修订版会立即杀死所有正在运行的东西以及对服务进行中的每个请求时,也许我错了。)
When you deploy a new revision, the new request are routed to the new revision.当您部署新修订时,新请求将路由到新修订。 The currently running request continue on the existing instances of the previous revisions.当前正在运行的请求在先前修订的现有实例上继续。 When there is no active request on an instance of the old revision, it will be deleted after a while (about 15 minutes today).当旧版本的实例上没有活动请求时,会在一段时间后(今天大约 15 分钟)将其删除。
So, the 2 questions are related.所以,这两个问题是相关的。 But a remarks: If you run PHP script with Cloud Scheduler, the HTTP request that you perform must stay active up to the end of the script.但请注意:如果您使用 Cloud Scheduler 运行 PHP 脚本,则您执行的 HTTP 请求必须保持活动状态直到脚本结束。 If you send a response in your PHP script before the end on the processing, firstly the CPU will be throttle and you script will be very very very slow.如果您在处理结束之前在 PHP 脚本中发送响应,首先 CPU 将受到限制,您的脚本将非常非常缓慢。 And secondly, Cloud Run service will consider the instance as inactive (not serving active request) and can delete it as it wants.其次,Cloud Run 服务会将实例视为非活动实例(不服务活动请求)并可以根据需要将其删除。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.