Change the automatic scaling minimum number of instances at different times of day?

158 views
Skip to first unread message

Parth Mishra

unread,
Jul 5, 2018, 9:53:21 AM7/5/18
to Google App Engine
For a flex environment service, would it be possible to create a script that calls the Admin API patch call to update the minimum number of instances at certain times of day (via a cron job or something)? 

The use case for this is that I know when my traffic will roughly spike by a lot at a given time of day and if I wait for the autoscaler to scale up instances, the latency of my requests will be too high since flex instances take minutes to scale up and I need to finish processing any given request within a minute (internal requirement). I would be setting the minimum instances to handle the average expected load at any given hour. It would slightly inefficient if the load is less than expected, but I would be able to fulfill processing requirements for the majority of incoming requests without having to set a high minimum number of instances all day. 

Is this possible to dynamically update the autoscaling settings? or is there a better way of going about this? 
Message has been deleted

Parth Mishra

unread,
Jul 5, 2018, 10:50:51 AM7/5/18
to Google App Engine
Maybe its bugged on my end but I see a response with no text?

On Thursday, July 5, 2018 at 10:45:33 AM UTC-4, Mohibul (Google Cloud Support) wrote:

Nathan (Cloud Platform support)

unread,
Jul 6, 2018, 1:09:29 PM7/6/18
to Google App Engine
Regarding Parth question: yes you can use the admin API patch method. The parameter to set would be for the flexible environment:min_total_instances  and for the standard environment: min_idle_instances. 


On Thursday, July 5, 2018 at 9:53:21 AM UTC-4, Parth Mishra wrote:

Parth Mishra

unread,
Jul 6, 2018, 2:23:07 PM7/6/18
to Google App Engine
I found out that I can in fact do that as you suggested, but the documentation for the Admin API leaves out the fact that you need to specify "env: flex" in the request body otherwise it won't work. 

Nathan (Cloud Platform support)

unread,
Jul 9, 2018, 1:08:52 PM7/9/18
to Google App Engine
The document that have that information is the Resource: Version. You can look for the description for the env field. It mentions the default is standard and to define the execution environment. 
Reply all
Reply to author
Forward
0 new messages