Hey Evan, I can't necessarily relate any experience with writing a custom auto-scaler, but I have some pieces of advice which might help with broad overview of possibilities.
One service to look into leveraging is Cloud Monitoring <https://cloud.google.com/monitoring/>, which allows you to monitor all kinds of metrics related to your application, from CPU usage to request latency (using custom metrics <https://cloud.google.com/monitoring/custom-metrics/using-custom-metrics>). You can use webhook notifications <https://support.stackdriver.com/customer/portal/articles/1491775-configuring-webhooks> to notify your control instance(s) to spin up / down instances according to upper / lower bounds on relevant metrics. There's also the possibility of using the Compute Engine Autoscaler <https://cloud.google.com/compute/docs/autoscaler/> to manage the instances by grouping them, which also has support for use of custom metrics <https://cloud.google.com/compute/docs/autoscaler/scaling-cloud-monitoring-metrics> . Overall, the more granular your desired control of scaling, the closer you get to writing entirely custom control logic in an instance, although there are several scaling / monitoring solutions which exist already. Finally, your Feature Request will be responded-to shortly and if implemented, would make much of this superfluous, but you might quite enjoy having the sort of granular control that you described coding. The main problems to be solved are accurate monitoring / projection of available resources vs resources required, and the technical question of how to implement control of scaling in line with that. I hope this has helped turn some wheels, let me know if you have any further questions, and hopefully others with more practical experience could chime in? Regards, Nick Cloud Platform Community Support On Monday, May 2, 2016 at 9:51:42 AM UTC-4, Evan Jones wrote: > > We are considering implementing our own automatic scaling policy by > periodically monitoring our service and calling the SetNumModules() API > that App Engine provides. We want to work around the bug that when you > deploy to an automatically scaled Flexible Environment service, the current > policy switches your production load on to your minimum number of > instances, rather than scaling up the new version to match the old version > (issue filed): > > https://code.google.com/p/googleappengine/issues/detail?id=12936 > > > Before we embark on this bug workaround adventure: has anyone successfully > written their own automatic scaling policy, for any reason? Was it easy or > hard? Are there any bugs for us to be aware of? > > Thanks! > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-appengine. To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/0fa14bf0-bd78-4643-b6a3-01f3d52edbfa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
