1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Cloud Runでサービス全体の同時リクエスト数を制限する方法

Last updated at Posted at 2020-11-30

Cloud Runでは、 サービスデプロイ時に --concorrency オプションを指定することで並列で裁く同時リクエスト数の上限を設定することができます。
gcloud beta run services update [SERVICE_NAME] --concurrency=1

しかし、このオプションはコンテナインスタンス単位の同時リクエスト数の上限設定のため、実際に来た同時リクエストの数が設定した上限を超えた場合は、別のコンテナが立ち上がり、全て並列で処理しようとします。
例えば、 gcloud beta run services update [SERVICE_NAME] --concurrency=1 で同時リクエスト数の上限を1と設定した場合、同時リクエストが10件来た時には10個のコンテナインスタンスが立ち上がることになります。

Cloud Runのサービス全体で同時リクエスト数を制限したい場合は、 コンテナインスタンス数の上限を設定できるオプション --max-instances も合わせて設定することで実現可能です。
例えば、Cloud Runのサービス全体で同時リクエスト数を1としたい場合は、--concorrency 及び --max-instances をそれぞれ1に設定することで実現できます。
gcloud run update [SERVICE_NAME] --max-instances 1 --concurrency 1

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?