How to stop Google AppEngine instances when not be

2019-07-31 16:29发布

We are developing a small e-commerce project for which we are using GAE as our web service backend but it's draining our financial resources. We studied our current infrastructure and how it was billed. That shows us that it's because of the instances we are using.

We have 7 services running which is using 12 instances as a whole.

Want to understand how to stop Google App Engine instances when not being used as it's the key contributor to our billing.

Services

UpdateFeed.yaml

application: ...
module: updatecategoryfeed
version: uno
runtime: python27
api_version: 1
instance_class: F1
threadsafe: true

automatic_scaling:
  min_idle_instances: 6
  max_idle_instances: automatic  # default value
  min_pending_latency: 30ms  # default value
  max_pending_latency: automatic
  max_concurrent_requests: 50

handlers:
- url: /.*
  script: FeedModule.FeedBuilder.update_category_feed



libraries:

- name: endpoints
  version: 1.0
- name: webapp2
  version: "latest"
- name: ssl
  version: latest

All other services following the same structure. We have a total of 7 active services.

Billing

UPDATE 2

We decreased the auto scaling values as per our project requirements which min idle instances to 0 and max idle instance to be 1. The price dropped drastically. But we are still looking for the answer on how to stop an instance when not being used. For ex. the below graph shows an instance started on its own without any activity and is being billed.

enter image description here

1条回答
Explosion°爆炸
2楼-- · 2019-07-31 16:47

Drop your min_idle_instances configuration in the automatic_scaling section - those configs effectively represent instances running at all times - also called resident instances for that reason.

Their role is not to handle traffic regularly. They only handle overflow traffic for short periods of time when the traffic exceeds the capacity of the running dynamic instances to keep the latencies low, while GAE spins up additional dynamic instances (which are the ones actually handling the bulk of the traffic).

Just in case it's not clear - resident instances aren't going away - it is their job to remain alive even if there is no activity on the site.

查看更多
登录 后发表回答