ekalinin / awsping

Console tool to check the latency to each Amazon EC2 region
MIT License
167 stars 31 forks source link

Dns preload #14

Closed rbarazzutti closed 2 years ago

rbarazzutti commented 2 years ago

This PR aims to avoid DNS resolution to be done at the time an HTTP or an HTTPS request is being done.

before:

./awsping -http -repeats 3 -verbose 2
      Code            Region                             Try #1          Try #2          Try #3     Avg Latency
    0 eu-central-1    Europe (Frankfurt)               58.93 ms        50.04 ms        49.44 ms        52.14 ms
    1 eu-south-1      Europe (Milan)                   77.22 ms        54.62 ms        54.34 ms        62.06 ms
    2 eu-west-3       Europe (Paris)                   76.70 ms        59.90 ms        59.67 ms        65.42 ms
    3 eu-west-2       Europe (London)                  96.93 ms        69.79 ms        69.43 ms        78.72 ms
    4 eu-north-1      Europe (Stockholm)              101.33 ms        89.63 ms        89.99 ms        93.65 ms

the first try takes significantly more time than the following ones

after:

./awsping -http -repeats 3 -verbose 2
      Code            Region                             Try #1          Try #2          Try #3     Avg Latency
    0 eu-central-1    Europe (Frankfurt)               42.42 ms        44.20 ms        45.51 ms        43.38 ms
    1 eu-south-1      Europe (Milan)                   50.62 ms        48.84 ms        45.06 ms        48.17 ms
    2 eu-west-3       Europe (Paris)                   55.75 ms        49.29 ms        54.05 ms        53.03 ms
    3 eu-west-2       Europe (London)                  64.55 ms        67.16 ms        65.88 ms        65.87 ms
    4 eu-west-1       Europe (Ireland)                 81.29 ms        85.92 ms        80.19 ms        82.47 ms
ekalinin commented 2 years ago

Thanks!