简体   繁体   English

在部署新服务修订期间,Cloud Run 如何处理我的应用程序中运行的内容?

[英]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.

相关问题 Google Cloud Run - 使用机密时无法部署新修订 - Google Cloud Run - Cannot deploy new revision while using secrets 如何从服务本身检索 Cloud Run 服务的名称和修订版? - How to retrieve name and revision of a Cloud Run service, from the service itself? 如何在 GCP(云运行)上部署 Go 应用程序? - How to deploy an Go application on GCP (Cloud run)? 如何查看在我的 Google Cloud Platform Cloud Run 服务上运行的文件? - How to see the files running on my Google Cloud Platform Cloud Run service? 更改 Google Cloud 项目网络服务层会更改正在运行的服务还是仅适用于新事物? - Does changing the Google Cloud project network service tier change running services or only apply to new things? 在 GKE 上部署 GPU 密集型 Cloud Run 服务 - Deploy a GPU intensive Cloud Run service on GKE 无法作为服务帐户部署到谷歌云运行 - Cannot deploy as a service account to google cloud run 如何在PHP和Google Cloud Platform上部署PHP应用程序? - How can I deploy my PHP application on Google cloud Platform? 如何在Google Cloud Platform中部署我现有的NodeJS应用程序 - How to deploy my existing NodeJS application in Google Cloud Platform 如何在本地运行我的Cloud Run服务? - How do I run my Cloud Run service locally?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM