A few things worth mentioning:

1- The "max_instances" element under "automatic_scaling" is a parameter 
that cannot be set in app.yaml if using 'appcfg'. This is why you were 
getting the deployment error, and is documented here [1]. You should 
instead set this specific parameter in the API explorer [2] or the Admin 
API [3].

2- Setting "max_idle_instances: 0" is invalid, as the accepted range for 
the value is between 1 and 1,000 which is explained here [4]. Part of the 
auto_scaling process requires to have instances in an idling state at some 
point, so setting it to 0 doesn't make sense. You may set this value to a 
lower value than what would be enforced by the default value "automatic", 
which will lower costs but can degrade performance in the face of volatile 
load levels. The goal is to strike a balance between costs and acceptable 
performance per your own standards.

3- The "min_idle_instances" [5] is a value you may be interested in reading 
more about as well, as this is one way to reduce costs but also necessitate 
tuning to make sure the desired performance is also met, as is the case 
with the "max_idle_instances" setting. For example, if there are long 
stretches of time where there are no requests, the number of idle instances 
could go to zero which would incur no costs. Doing so will generate a cold 
start from the next loading request [6], which will have a higher latency. 
If you prefer to always have an idle instance ready to serve request, this 
reduces latency by eliminating the loading requests but incur higher costs. 
You could also look into warmup requests [7].

4- Idle instances are not free as mentioned here [4], and explained more 
specifically here [8].

[1] 
https://cloud.google.com/appengine/docs/standard/python/config/appref#automatic_scaling_max_instances
[2] 
https://cloud.google.com/appengine/docs/standard/python/config/setting-autoscaling-params-in-explorer
[3] 
https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1/apps.services.versions/patch
[4] 
https://cloud.google.com/appengine/docs/standard/python/config/appref#max_idle_instances
[5] 
https://cloud.google.com/appengine/docs/standard/python/config/appref#min_idle_instances
[6] 
https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#loading_requests
[7] 
https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#warmup_requests
[8] 
https://cloud.google.com/appengine/docs/standard/go/how-instances-are-managed#instance_billing

On Friday, December 20, 2019 at 9:47:55 AM UTC-5, Joshua Smith wrote:
>
> I have a not-for-profit site that I run for a variety of local 
> governments. Over the past year, my costs have been increasing and I’m 
> looking for ways to lower them.
>
> I’ve had some luck with robots.txt and the firewall (damn there are a lot 
> of non-robot-compliant crawlers running from Azure IP addresses). But the 
> bottom line hasn’t changed much.
>
> A big cost driver has been Instances. Looking at my dashboard I see that 
> auto-scaling seems to like to leave around a lot of idle instances:
>
>
> Looking at the docs, I was pleased to see that at some point, apps got 
> more control over auto-scaling. Accordingly, I tried adding this to 
> app.yaml:
>
> automatic_scaling:
>   max_instances: 3
>   max_idle_instances: 1
>   max_pending_latency: 100ms
>   max_concurrent_requests: 20
>
> Alas, if I try to deploy (I’m still using python 2.7 and the Launcher), I 
> get this error:
>
> appcfg.py: error: Error parsing app.yaml: Unexpected attribute 
> 'max_instances' for object of type AutomaticScaling.
>   in "app.yaml", line 8, column 18.
>
> Launcher says it’s up-to-date, but I’m sure it isn’t. Is this simply a 
> matter of finding and installing the latest Launcher app? I’ve been 
> avoiding that because I know google wants me to stop using it, so I have 
> been in “if it ain’t broke, don’t fix it” mode.
>
> -Joshua
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/1416465f-52d2-45e6-a4ab-40773271fe0b%40googlegroups.com.

Reply via email to