your programing

Google App Engine Flexible 환경의 가격, $ 500 강의

lovepro 2020. 12. 29. 08:06
반응형

Google App Engine Flexible 환경의 가격, $ 500 강의


App Engine Flexible env 튜토리얼 @ : https://cloud.google.com/nodejs/getting-started/hello-world 에서 Nodejs를 따랐습니다.

튜토리얼을 성공적으로 배포하고 테스트 한 후 코드를 약간 변경하여 성공적으로 배포 한 다음 테스트 환경 (공개 아님)이므로 계속 실행했습니다.

한 달 후 Google로부터 370 달러가 넘는 청구서를 받았습니다!

거래 세부 정보에서 다음을 확인합니다.

2017 년 10 월 1 일 ~ 31 일 App Engine Flex 인스턴스 RAM : 5948.774 Gibibyte-hours ([MYPROJECT]) $ 42.24

2017 년 10 월 1 일 ~ 31 일 App Engine Flex 인스턴스 코어 시간 : 5948.774 시간 ([MYPROJECT]) $ 312.91

거의 요청이 거의없는이 테스트 환경에서 약 6,000 시간의 리소스가 필요했던 이유는 무엇입니까? 최악의 경우 한 달 동안 풀 타임으로 720 시간을 실행하는 데 시간당 $ 0.05의 비용이 약 $ 40라고 가정했을 것입니다. https://cloud.google.com/appengine/pricing

누군가 이것에 대해 밝힐 수 있습니까? 왜 그렇게 많은 자원이 필요한지 알 수 없었습니까?

도와 주셔서 감사합니다!

더 많은 데이터의 경우 지난달 트래픽 (기본적으로 0)입니다. 교통 데이터

그리고 인스턴스 데이터인스턴스 데이터

업데이트 : package.json에 한 가지 수정 사항을 적용했습니다. nodemon을 종속성으로 추가하고 "nmp start"스크립트의 일부로 추가했습니다. 이것이 6000 시간의 자원을 설명하는 것은 의심 스럽지만 :

  "scripts": {
    "deploy": "gcloud app deploy",
    "start": "nodemon app.js",
    "dev": "nodemon app js",
    "lint": "samples lint",
    "pretest": "npm run lint",
    "system-test": "samples test app",
    "test": "npm run system-test",
    "e2e-test": "samples test deploy"
  },

App.yaml (기본값-튜토리얼에서 변경 없음)

runtime: nodejs
env: flex

구글과 여러 번왔다 갔다하고 블로그를 읽고 보고서를 보며 마침내 (다소) 무슨 일이 일어 났는지에 대한 설명을 찾았습니다. 다른 사람들도이 문제의 희생양이되지 않도록 제 제안과 함께 여기에 게시하겠습니다.

일부 사람들에게는 이것이 분명해 보일 수 있지만 새로운 GAE 사용자로서이 모든 것이 저에게 새로운 것이 었습니다.

간단히 말해서 GAE에 배포하고 다음 명령어 ' $ gcloud app deploy '를 사용하면 새 버전을 만들고 기본값으로 설정하지만 더 중요한 것은 배포 된 이전 버전을 제거하지 않는다는 것입니다.

버전 및 인스턴스에 대한 자세한 정보는 https://cloud.google.com/appengine/docs/standard/python/an-overview-of-app-engine 에서 찾을 수 있습니다.

그래서 제 경우에는 모르는 사이에 간단한 노드 앱의 여러 버전을 만들었습니다. 이러한 버전은 오류가 발생한 후 전환해야하는 경우를 대비하여 계속 실행됩니다. 그러나 이러한 버전에는 인스턴스도 필요하며 app.yaml에 명시되지 않는 한 기본값은 2 개의 인스턴스입니다.

구글 말한다 :

기본적으로 App Engine은 부하에 맞게 실행되는 인스턴스 수를 확장하여 항상 앱에 일관된 성능을 제공하는 동시에 유휴 인스턴스를 최소화하여 비용을 절감합니다.

그러나 내 경험으로는 그렇지 않았습니다. 앞서 말했듯이 오류를 일으키는 것으로 보이는 nodemon으로 노드 앱을 푸시했습니다.

결국 튜토리얼을 따라 프로젝트를 종료하지 않고 각각 1.5 개월 동안 풀 타임으로 실행되는 2 개의 인스턴스가 0 개의 요청을 처리하고 많은 오류 메시지를 생성하는 4 개의 버전이 있었고 비용은 500 달러였습니다.

GAE FLEX ENV를 계속 사용하려는 경우 권장 사항 :

  1. 가장 먼저 CC에 자동으로 청구되는 비싼 인보이스에 놀라지 않도록 결제 예산 및 알림을 설정하세요. https://cloud.google.com/billing/docs/how-to/budgets

  2. 테스트 환경에서는 여러 버전이 필요하지 않을 가능성이 높으므로 배포하는 동안 다음 명령을 사용하십시오.
    $ gcloud app deploy --version v1

  3. 최소한의 리소스로 인스턴스 1 개만 강제하도록 app.yaml업데이트합니다 .

runtime: nodejs
env: flex

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10
  1. 일일 지출 한도 설정

여기에 이미지 설명 입력

자세한 내용은이 블로그 게시물을 참조하십시오. https://medium.com/google-cloud/three-simple-steps-to-save-costs-when-prototyping-with-app-engine-flexible-environment-104fc6736495

학습하고 실험하려는 사람들을 보호하기 위해 이러한 단계 중 일부가 튜토리얼에 포함 되었으면하지만 그렇지 않았습니다.

Google App Engine Flex env can be tricky if one does not know all these details. A friend pointed me to Heroku, that has both set pricing and Free/Hobby offers. I was able to quickly push a new node app there, and it worked like charm! https://www.heroku.com/pricing

It "only" cost me $500 to learn this lesson, but I do hope this helps others looking at Google App Engine Flex Env.


We had code deployed to GAE FE go absolutely nuts due to a cascading, exponential failure (bounced emails generated bounced-email emails, etc.) and we could NOT turn off the GAE instances that were bugged. After 4+ hours, and 1M+ emails sent (Mailgun just would NOT let us disable the account. It said "Please wait up to 24 hours for the password change to go into effect", and revoking API keys did nothing), the redis VM was stopped, the DB down, and all the site's code reduced to a single "Down For Maintenance" static 503 page), the emails kept being sent.

I determined that GAE FE just simply does not end either docker VMs or Cloud Compute VMs (redis) that are under CPU load. Maybe never! Once we actually deleted the Compute VM (instead of "merely" stopping it), the emails instantly stopped.

But, our DB continued to get filled with "could not send email" notices for up to 2 more hours, despite the GAE app reporting 100% of the versions and instances to be "Stopped". I ended up having to change the Google Cloud SQL password.

We kept checking the bill, and the 7 rogue instances kept using up CPU and so we cancelled the card used on that account, and the site did, in fact, go down when the bill was past due, but so did the rogue instances. We never were able to resolve the situation with GAE email support.


Thanks for sharing! After reading this article my bill went down like the graph below

가파른 절벽

내 문제는 새 버전을 배포 할 때 이전 버전이 중지되었다고 가정했다는 것입니다 (배포 할 때 i gcloud, 트래픽 분할 및 버전 중지 ...).하지만 버전 페이지를 자세히 살펴본 결과 많은 오래된 머신이 여전히 실행 중이지만 트래픽의 0 %를 제공합니다. 배포시 버전을 지정하여 값 비싼 실수를 쉽게 수정할 수 있습니다.

gcloud app deploy --version v1

누군가에게 도움이 되죠?


또한 앱에 자동 확장 기능이 있지만 기본 최소 2 개의 인스턴스가 항상 실행되는 것을 원하지 않는 경우 다음과 같이 app.yaml을 구성 할 수 있습니다.

runtime: nodejs
env: flex
automatic_scaling:
  min_num_instances: 1

참조 URL : https://stackoverflow.com/questions/47125661/pricing-of-google-app-engine-flexible-env-a-500-lesson

반응형