旨在轻松迁移到 Google App Engine

发布于 2024-08-23 07:53:52 字数 174 浏览 4 评论 0原文

我很快就会开始设计一个 Web 应用程序,虽然我在 SQL 领域拥有丰富的经验,但我不知道这样做需要考虑什么,以便在不久的将来迁移到 GAE未来。

或者,我可以从一开始就为 GAE 设计应用程序,那么在这种情况下,我需要考虑哪些差异?换句话说,从过去的关系数据库来看,为 GAE 编写应用程序应该做什么和不应该做什么。

I am going to start designing a web app shortly, and while I have lots of experience doing it in the SQL world, I have no idea what I need to take into consideration for doing so with the goal of migrating to GAE in the very near future.

Alternatively, I could design the app for GAE from the start, and so in that case, what are the differences I need to take into consideration? In other words, what are the DOs and DONTs of writing your app for GAE, coming from a relational databases past.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

追风人 2024-08-30 07:53:52

就在我的脑海中:

  • 它实际上只是一个键->值存储,不要被诸如 GQL (这只是 SQL SELECT 的子集)
  • 无 JOIN - 通常您必须非规范化或忘记
  • 或多或少频繁的超时
  • (非常)与本地 SQL 库相比,访问速度较慢。
  • 在客户端实现的COUNT 非常昂贵的
  • OFFSET(在 SELECT 中) - 所以实际上你获取了所有记录直到 offset - 正如 Nick Johnson 在评论之一中指出的,它不是客户端,所以现在,由于 1000 的 LIMIT 已经消失,它与 SQL 数据库类似。
  • (最近删除)限制为 1000 条提取行
  • SELECT 性能随着返回行数的增加而急剧下降
  • 迁移很难完成,因为您必须使用普通的 http 请求来完成迁移,并且每个请求会在 30 秒后被终止。你必须求助于批量处理行的任务队列
  • 有伪外键 - 在Python API中称为ReferenceProperties - 但它们不会以任何方式强制执行 - 如果某人/某物删除目标对象,那么你就会有所谓的悬空指针 C++
  • 用于查询的
  • 字段必须建立索引,但仍然使用 key (每行/实例的主键)可以使查询运行得更快在实时实例上构建索引可能需要花费大量时间(并且您无法减少它),如果没有它们,您的应用程序通常无法运行。强烈推荐啤酒和耐心。
  • 很多人为限制(例如已经删除的最大 LIMIT 1000)。例如,GQL 'IN' 运算符只是多个 OR-的语法糖,并且使用的值上限为 30 个。

所有这些意味着您可能无法避免向用户暴露不一致的状态,并且几乎可以肯定您无法避免数据的不一致状态(例如,在手动 JOIN 数据更改期间,一半行已迁移,一半未迁移)

Just out of top of my head:

  • It's really ONLY a key->value store, don't be fooled by things like GQL (which is just a subset of SQL SELECT)
  • No JOINs - often you have to denormalize or forget
  • More or less frequent timeouts
  • (Very) slow access comparing to local SQL base.
  • COUNT very expensive
  • OFFSET (in SELECT) implemented on client side - so in fact you fetch all records up to offset - as pointed by Nick Johnson in one of the comments, it's not client side, so now, as LIMIT of 1000 is gone it's similar to SQL databases.
  • (Recently removed) LIMIT of 1000 fetched rows
  • SELECT performance decreases drastically with increasing number of returned rows
  • Migrations are hard to do because you have to do them using normal http requests and each request is killed after 30 secs. You have to resort to task queues that process rows in batches
  • There are pseudo foreign keys - called ReferenceProperties in Python API - but they are not enforced in any way - if someone/something delete target object then you have what is know as dangling pointer in C++
  • Fields that you use for queries have to be indexed, but still using key (sort of primary key for each row/instance) makes your queries run faster
  • Building indexes on live instance can take a lot of time (and you can't decrease it) and without them your app often can't work. Beer and patience highly recommended..
  • A LOT of artificial limits (like the already removed max LIMIT of 1000). E.g. GQL 'IN' operator is just syntactic sugar for multiple OR-s, and there is upper limit of 30 values used.

All that means that you probably can't avoid exposing inconsistent state to user, and almost for sure you cannot avoid having inconsistent state of your data (e.g. half rows migrated and half not, during manual JOIN data changes etc)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文