简体   繁体   English

Google App Engine:CRUDing实例

[英]Google App Engine: CRUDing Instances

I've read the Instances Overview for GAE and it is very informative, however when it comes to actually CRUDing Instances I'm just not seeing the "forest through the trees." 我已经阅读了GAE的“ 实例概述 ”,它的内容非常丰富,但是,当涉及到对实例进行实际挖掘时,我只是没有看到“树林中的森林”。

In some literature, it sounds like GAE "auto-scales" your app and dynamically calculates the number of Instances you need in order to handle the current server load. 在某些文献中,这听起来像GAE可以“自动缩放”您的应用并动态计算所需的实例数,以处理当前服务器负载。 However the article above concerns itself primarily with creating and managing Instances manually via the Admin Console. 但是,以上文章主要涉及通过管理控制台手动创建和管理实例。

How are these two concepts related/different? 这两个概念是如何相关/不同的?

I ask because I've read the same consistent advice over and over again: try to keep the number of Instances you have running at all times as low as possible (since less Instances results with being billed less). 我之所以问,是因为我一遍又一遍地阅读了相同的一致建议: 尽量使您一直在运行的实例数尽可能少(因为更少的实例产生了更少的费用)。 But I'm not sure if this is a manual "pruning" job that requires me to be logging into my Admin Console every 10 minutes to see if new Instances need to be created or existing ones destroyed/shutdown; 但是我不确定这是否是一项手动的“修剪”作业,是否需要每10分钟登录到我的管理控制台,以查看是否需要创建新实例或是否需要销毁/关闭现有实例? or if this is something that is auto-calculated. 或者这是自动计算的结果。

If it is auto-calculated, then what is the point of CRUDing Instances manually via the Admin Console? 如果是自动计算的,那么通过管理控制台手动进行CRUDing实例有什么意义? Thanks in advance! 提前致谢!

AppEngine definitelly autoscales. AppEngine绝对会自动缩放。

However, it gives you ability to tweak the auto-scale mechanism to either go for cost or performance. 但是,它使您能够调整自动缩放机制以提高成本或性能。

Some rules: 一些规则:

  1. Every instance costs (however you get 28 instance hours free every day). 每个实例的费用(但是您每天可以免费使用28个小时)。
  2. When instance stops executing requests you stop being charged for it after 15 min of inactivity (thoughh it may stay up idle and visible in your instance list, if google has no better work for it). 当实例停止执行请求时,您会在闲置15分钟后停止收取费用(不过,如果google没有更好的方法,它可能会保持空闲状态并在您的实例列表中可见)。
  3. Every request goes in a into a Pending Queue and waits there until instance becomes available to execute it. 每个请求都进入待处理队列,并在该队列中等待,直到实例变得可以执行它为止。
  4. If it waits too long a new instance will be started (= autoscaling). 如果等待时间过长,则会启动一个新实例(=自动缩放)。 How long it must wait before new instance is stared is controlled by Pending Latency . 新实例启动之前必须等待多长时间, 由Pending Latency控制
  5. If you don't want requests to wait you can have a "reserved" instance by setting Idle Instances. 如果您不希望请求等待,可以通过设置空闲实例来拥有一个“保留”实例。 In this case GAE will always try to have an Idle Instance available, meaning if Idle Instance gets work to do GAE will create a new one. 在这种情况下,GAE将始终尝试提供一个空闲实例,这意味着如果空闲实例可以完成,GAE将创建一个新实例。 So your number of instances = instances doing work (processing requests) + number of Idle Instances. 因此,您的实例数=执行工作(处理请求)的实例+空闲实例数。 Basically Idle Instances are just a reserve, not doing real work, except when working instances can't cope with the load, then Idle Instance jumps in, becoming a working instance, while a new Idle Instance is being spun up. 基本上,空闲实例只是一个储备,不做实际工作,除非工作实例无法应付负载,然后空闲实例跳入,成为工作实例,同时正在旋转一个新的空闲实例。 Note: Idle Instences are in admin console marked as "Resident" (why Google do you do this, why?). 注意:空闲状态位于管理控制台中,标记为“常驻”(为什么Google这么做,为什么?)。

Btw, where do the docs say you can manually start an instance? 顺便说一句,文档在哪里说您可以手动启动实例?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM