0
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 1 year has passed since last update.

AWS Ec2 Nginx Timeout 設定(忘備録)

Last updated at Posted at 2022-12-08

経緯

処理時間が60秒超えたら、504 Gateway timeoutが発生する

対応

対応1.

  • Ec2に連結されているApplication Load Balancer の問題かと思い、アイドルタイムアウト3600 秒で設定する

対応2.

  • 対応1を行ってたら、3分後に同様のタイムアウトが発生する
  • ちなみにタイムオーバする処理でDuplicateエラーが発生してた(内部ロジックの都合)

対応3.

proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;

対応4.

上司:サーバ設定は内容知った上で設定しましょ

  1. proxy-connect-timeout
    プロキシサーバの連結する時間

  2. proxy-send-timeout
    プロキシサーバにリクエストする時間

  3. proxy-read-timeout
    プロキシサーバから回答を待つ時間

うちらの場合、バックエンド側の処理が長かったので、アップロードや連結時間などは関係なかった

proxy_read_timeout 300;

こちらのみの設定で遠かった

追記

  • proxy_read_timeoutの基本設定が60秒だが、レスポンスがなければ1分間リトライしている模様
  • リトライ3回行ってたらバックエンド動作が動いているかどうか関係なく接続を切る模様

2022/12/18 追加

  • 上記の問題はブラウザーの問題でした。下記の記事を確認してほしいです

0
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
0
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?