Google App Engine部分升级 [英] Google App Engine upgrading part by part

查看:209
本文介绍了Google App Engine部分升级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用PHP编写的复杂的appengine服务,现在我想逐个将其迁移到Python。



假设我的服务有2个部分: / signIn /.... / data /...。我只想先迁移 / signIn / 部分,然后再迁移 / data /



但是,由于我的服务很大,所以我想在Python中构建新的 / signIn / 部分,然后使用交通分流对这部分进行一些A / B测试。



我的问题是Traffic Splitting仅适用于版本,所以我的旧版本和新版本必须位于同一个模块中,而同一个模块意味着它们必须以相同的方式写入语言(我在这里错了,看更新的部分)。但是我正在从PHP迁移到Python。



对我来说最好的解决方案是什么?



谢谢,

解决方案

Dan Cornilescu的帮助下, p>


  1. 将应用程序分为2个模块:默认版本和旧版本。 > / signIn / 复制到默认模块中,其余部分复制到旧版模块中。 创建 / signIn / default module
  2. 配置流量分离以缓慢增加Python部分中的请求百分比。这将使我们能够测试并确保没有发生严重的错误。

注意:
/ signIn / 部分必须是默认模块,因为GAE的流量分割仅适用于默认模块。



我证实我们可以将2不同语言版本的模块。

解决方案

一种可能的方法是在第一步中将模块中的PHP应用程序拆分。这不是一个完全浪费的工作,大多数情况下都需要您的应用程序在多个模块中工作,而不涉及语言更改。我怀疑这实际上是为什么你不能使用A / B测试 - 模块之间不匹配。不可避免的。

一旦模块拆分完成,您可以继续进行第二步 - 切换所选模块的语言,并将A / B测试作为你的意图。



更加勇敢的方法是混合2并直接在python中编写 / signin / 模块。在PHP方面,您只需删除 / signin / 部分(前面提到的第一步的一部分)。只要您小心只使用应用程序语言无关的方式进行模块间通信/操作:请求路径,Cookie,数据存储/内存缓存键等,应该工作得很好。好的模块拆分几乎可以确保这一点。

除A / B外,您还有其他测试选项,如下所示: https ://stackoverflow.com/a/33760403/4495081

你也可以让新的代码/模块能够像旧的一样并排/同时使用 dispatch.yaml 文件来精确控制哪个模块实际提供哪些请求。这可能允许进行非常有针对性的迁移,可能会提供更高的测试信心。



我也不完全确定实际上不能在同一个模块中使用2个版本语言 - 版本应该是相当独立的实例,每个实例都以自己的方式使用自己的请求,并在最底层使用与语言无关的GAE infra服务。 AFAIK没有什么能阻止 complete 应用程序的重新编写和部署,使用相同的版本 - 我在学习GAE时已经做到了。但我没有切换语言,这是真的。我会试试看,但我现在没有时间学习一种新语言了。)


I have a complex appengine service that was written in PHP, now I want to migrate it to Python part by part.

Let's say that my service has 2 parts: /signIn/.... and /data/.... I just want to migrate /signIn/ part first, then /data/ later.

However, since my service is big, so I want to build new /signIn/ part in Python, then use Traffic Splitting to make some A/B Testing on this part.

My problem is that Traffic Splitting can be applied on versions only, so my old and new versions have to be in same module, and same module means that they have to written in same language (I was wrong here, see updated part). But I am migrating from PHP to Python.

What is the best solution for me?

Thanks,

Solution

With Dan Cornilescu's helping, this is what I do:

  1. Split the app into 2 modules: default and old-version.
  2. Dispatch /signIn/ into default module, the rest to old-version module.
  3. Make another version of /signIn/ (default module) in Python
  4. Configure Traffic Splitting to slowly increase requests percent into Python part. This will allow us to test and make sure there is no serious bug happen.

Note: The /signIn/ part must be default module, since GAE's traffic splitting works at default module only.

I confirmed that we can make 2 versions in different language for a module.

解决方案

One possible approach is to split your PHP app in modules in a 1st step. It's not a completely wasted effort, most of that will be needed anyways to just allow your app to work in multiple modules, not related to the language change. I suspect this is actually why you can't use A/B testing - mismatch between the modules. Unavoidable.

Once the split in modules is done then you can go on with your 2nd step - switching the language for selected module(s), with A/B testing as you intended.

A more brave approach is to mix the 2 and write the /signin/ module directly in python. On the PHP side you'd just remove the /signin/ portion (part of the earlier mentioned 1st step). Should work pretty well as long as you're careful to only use app language independent means for inter-module communication/operation: request paths, cookies, datastore/memcache keys, etc. A good module split would almost certainly ensure that.

You have testing options other than A/B, like this one: https://stackoverflow.com/a/33760403/4495081.

You can also have the new code/module able to serve the same requests as the old one, side-by-side/simultaneously and using a dispatch.yaml file to finely control which module actually serves which requests. This may allow a very focused migration, potentially offering higher testing confidence.

I'm also not entirely sure you can't actually have 2 versions of the same module in different languages - the versions should be pretty standalone instances, each serving their own requests in their own way using, at the lowest layer, the language-independent GAE infra services. AFAIK nothing stops a complete app re-write and deployment, with the same version or not - I've done that when learning GAE. But I didn't switch languages, it's true. I'd give it a try, but I don't have time to learn a new language right now :)

这篇关于Google App Engine部分升级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆