阻止Google App Engine Cron作业创建多个实例(从而烧毁我所有的实例时间) [英] Preventing Google App Engine Cron jobs from creating multiple instances (and thus burning through all my instance hours)

查看:85
本文介绍了阻止Google App Engine Cron作业创建多个实例(从而烧毁我所有的实例时间)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与该问题非常相关(
实例从2-> 3变为每分钟只有一个cron-job。



我也很难理解为什么创建了3个实例,而0正在运行,并且结算估算为1。



与Google联系可能会使我指向大量实例(这导致大量实例小时),而我的参数设置为自动抓斗,因此可以做到这一点。但是,将其更改为手动会限制免费实例小时数(从28到9)。



我的处境



我正在运行cron-jobs来调用Pub / Sub事件。我有Google Cloud函数,可以监听发布/订阅事件,因此我可以根据这些报价执行数据库更新。这是在



此外,不是在左上方有一个版本选择。我可以选择较旧的和最新的实例(而不是全部实例),它向我显示了正在空闲运行的较旧实例。这是问题是旧版本的另一种指示,而不是旧版本。每天学习!


Very related to this question (How can I prevent my Google App Engine cron jobs from burning through all my instance hours?), yet unfortunatly I not only experience something similar, in my Cron-jobs in Appengine multiple instances are created, which causes quite a high number of Instance hours to be billed.

I tried different intervals to determine whether this has an effect on the instance hours, but cannot determine the difference currently. To illustrate, I got billed App Engine Frontend Instances: 263.462 hours for the following three cron-jobs (in just 10 days!):

cron:
- description: Push a weather "tick" onto pubsub every 5 minutes
  url: /publish/weather-tick
  schedule: every 5 minutes

- description: Push a crypto "tick" onto pubsub every 5 minutes
  url: /publish/crypto-tick
  schedule: every 5 minutes

- description: Push a astronomy "tick" onto pubsub every 6 hours starting at 00:00
  url: /publish/astronomy-tick
  schedule: every 6 hours synchronized

When I changed this to one cron-job for each minute:

cron:
- description: Push a "tick" onto pubsub every 1 minutes
  url: /publish/minute-tick
  schedule: every 1 minutes

I currently still get multiple instances, see: Strangely enough, the instance went from 2 --> 3 upon changing to just one cron-job every minute.

I also have difficulties understanding why there are 3 instances 'created', whilst 0 are 'running', and billing estimates are 1.

Contact with Google could point me towards the high number of instances (which caused the high number of Instance hours), and my parameters set on 'automatic sclaing', which allows for this. However, changing it to manual limits the amount of free instance hours (from 28 to I believe 9).

My Situation

I am running cron-jobs to invoke Pub/Sub events. I have Google Cloud functions that listen to Pub/Sub events so that I can execute database updates based on these ticks. This is folllwing the tutorial provided on Google Firebase. I understand the billing of 15 minutes of an instance, even though it's lifespan is shorter, however I cannot understand how or why multiple are created if only such a small task is executed. I am especially intregued, as in the related question (How can I prevent my Google App Engine cron jobs from burning through all my instance hours?), that person is experiencing 24 hours, but expectedly just with one instance. Why am I getting 3? I feel I am missing some conceptual understanding of this process, and the tools to adjust accordingly. Any help or pointers would be very welcome!

解决方案

Ok, so as often - anoyingly but helpful - is, explaining it to someone else helps thinking about this problem. I hope this anwser might be useful for someone else having the same questions.

I stumbled upon this Google Groups discussion, which talks about how instances of 'older' versions are kept running due to the Flexible Environment, or even when scaling is set to manual. Quite recent comments indicate that this is a roll-back issue from Google's side. Apparently (I was unaware of this), you can delete or stop the older versions and thereby stop the running instances. A related Stack Overflow question and awnser can be found here: How to automatically delete old Google App Engine version instances?. This also discusses how to ensure automatic instance deletion from older versions (and is probably the correct way to go). Doing it manually: go to your Appengine dashboard, click versions in the left menu, and select and delete the older versions (if not needed anymore ofcourse). This named Google Groups discussion also shows how.

The result:

Also, not that there is a version selection in the top left. I could select the older and latest one (instead of 'all'), which showed me the idle running older instances. This is an additional indication of the 'issue' being the old versions, rather than this one. Learning everyday!

这篇关于阻止Google App Engine Cron作业创建多个实例(从而烧毁我所有的实例时间)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆