使用App Engine SDK进行并行模块部署

huangapple go评论74阅读模式
英文:

Parallel Module Deployment using App Engine SDK

问题

有没有一种方法可以并行部署App Engine模块?

我使用了Google的App Engine SDK for Go构建了一个Go应用程序。该应用程序定义了多个模块。这些模块是独立的,不需要与其他模块之间存在任何依赖关系。

当我尝试将这些模块部署到Google Cloud时,我注意到这些模块是按顺序上传的。如果部署相对快速,这可能还可以接受,但是每个模块都需要进行冗余的Go二进制编译。因此,除了常规的上传时间外,每次我想要部署应用程序时,还必须等待我的应用程序编译[模块数量] x [编译时间]。

显而易见的(快速)解决方案是并行部署,因此我创建了一个简单的bash脚本来独立部署每个模块。但是,我立即遇到了这个“解决方案”的问题,即来自App Engine API的HTTP 500响应。整个跨越所有模块的总体应用程序似乎在任何单个模块更新时都会“锁定”。这种情况会导致竞争条件,只有第一个触发部署的模块成功,其他模块失败。

我担心这是App Engine中遗留语言的问题。由于每个模块使用相同的Go二进制文件,它实际上不需要多次编译相同的代码。重复编译是多余的,并且没有办法绕过这个锁定。

一个假设的解决方案是并行编译,串行部署,但我对此只有模糊的理解。我想象这种方法可能涉及拆解配置工具,并重新设计它以按照上述方式执行-尽管我不能确定(尚未确定)。

在这方面的任何帮助将不胜感激。谢谢!

英文:

TL;DR Is there a way to deploy App Engine modules in parallel?

I've built a go application using Google's App Engine SDK for Go. This application defines multiple modules. These modules are self-contained, and do not require any sort of dependency across other modules.

When I attempt to deploy the modules to the Google Cloud, I can't help but notice that the modules are uploaded sequentially. This would be fine if deployment was relatively quick, but each module requires it's own redundant compilation of the Go binary. Hence, on top of the regular upload time, I have to wait for my app to compile [module count] x [compilation time] every time I want to deploy.

The obvious (quick) solution is to deploy in parallel, so I created a simple bash script to deploy each module independently. The problem I immediately encountered with this "solution" was a HTTP 500 response from the App Engine API. The whole umbrella application, spanning across all the modules, seems to "lock" whenever any individual module is updated. This scenario creates a race condition, under which only the first module to trigger a deploy succeeds and the others fail.

I fear that this is a holdover from the legacy languages in App Engine. Since every module uses the same Go binary, it doesn't really necessitate multiple compilations of the same code. Repeated compilation is redundant, and there is no way to circumvent the lock.

One hypothetical solution, which I have only a vague understanding of, is to compile in parallel and deploy in series. I imagine that this approach would involve taking apart the configuration tool and reworking it to execute in the aforementioned manner- though I can't say for sure (yet).

Any help here would be much obliged. Thanks!

答案1

得分: 1

你可以部署到你的App Engine应用的另一个“版本”,然后当所有模块都部署完成后,进行一个非常快速的版本切换。

如果你需要或者想要进行流量分割,版本也可以实现这种功能。

英文:

You can deploy to another "version" of your App Engine app, then when all modules are deployed, do a very fast version switch?

Versions also allow for traffic splitting if you need/want that kind of thing.

huangapple
  • 本文由 发表于 2015年1月12日 03:33:35
  • 转载请务必保留本文链接:https://go.coder-hub.com/27891216.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定