LoginSignup
1
0

More than 3 years have passed since last update.

Global Accelerator はターゲットから何秒レスポンスがないとタイムアウトするのか

Last updated at Posted at 2019-01-26

(2020-01-28 追記)

AWS Global Acceleratorのidle Timeoutは現在公式ドキュメントにて記載があります。
https://docs.aws.amazon.com/global-accelerator/latest/dg/introduction-how-it-works.html

Note
The idle timeout for the network connection depends on the type of connection:

The timeout is 300 seconds for TCP connections to endpoints with client IP address preservation enabled (Application Load Balancers and EC2 instances).

The timeout is 90 seconds for TCP connections to endpoints without client IP address preservation (Network Load Balancers and Elastic IP addresses).

概要

AWS Global Accelerator について、ふと疑問に思った点がありました。
ターゲットとなるエンドポイントから、どれくらいの間レスポンスがなかったらタイムアウトするのでしょうか?

例えば、API Gateway の場合、バックエンドとの間のタイムアウトは 50msec ~ 29sec で設定可能となっています。
https://docs.aws.amazon.com/ja_jp/apigateway/latest/developerguide/limits.html#api-gateway-execution-service-limits-table

今現在設定する項目はなく、制限情報のページにも記載がないので、とりあえず実際に試してみたいと思います。

構成

Global Accelerator --- EC2(Web/Python)

すごくシンプルです。

Webサーバー

Python でつくった簡単な Web サーバを EC2 で動かします。
3600 秒待ってからレスポンスを返すように作ってます。

webserver.py
#!/usr/bin/python
import time
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer

PORT_NUMBER = 8080

class myHandler(BaseHTTPRequestHandler):
    #Handler for the GET requests
    def do_GET(self):
        time.sleep(3600)
        self.send_response(200)
        self.send_header('Content-type','text/html')
        self.end_headers()
        # Send the html message
        self.wfile.write("Hello World !")
        return

try:
    server = HTTPServer(('', PORT_NUMBER), myHandler)
    print 'Started httpserver on port ' , PORT_NUMBER

    server.serve_forever()

except KeyboardInterrupt:
    print '^C received, shutting down the web server'
    server.socket.close()
$ sudo ./webserver.py
Started httpserver on port  80

計測結果

単純に curl で計測します。
とりあえず最大3600秒でタイムアウトする設定で測定しました。
Global Accelerator の2つのIPにそれぞれ2回、合計4回測定しましたが、概ね 75sec でタイムアウトする結果となりました。

$ curl -m 3600 -kL 'x.x.x.x' -o /dev/null -w "%{http_code}\t%{time_total}\n" 2> /dev/null
000 75.184206
$ curl -m 3600 -kL 'x.x.x.x' -o /dev/null -w "%{http_code}\t%{time_total}\n" 2> /dev/null
000 75.134897
$ curl -m 3600 -kL 'y.y.y.y' -o /dev/null -w "%{http_code}\t%{time_total}\n" 2> /dev/null
000 75.318919
$ curl -m 3600 -kL 'y.y.y.y' -o /dev/null -w "%{http_code}\t%{time_total}\n" 2> /dev/null
000 75.947411

まとめ

75秒、、、
net.ipv4.tcp_keepalive_intvlのデフォルト値が 75 なので関係があるのかな・・・
雑な検証なので、Global Acceleratorの仕様がこうというわけではなく、今回の環境ではこういう結果になったという感じですね。

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