ekalinin / awsping

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

Unexpected TCP latency results #2

Open atward opened 7 years ago

atward commented 7 years ago

There's not much you can do about it, but thought I should raise it as an FYI for future users.

When running awsping TCP test I got the following results from Australia, which was really confusing until I realised there was a transparent proxy in place.

$ ./awsping -verbose 2 -repeats 3
      Code            Region                             Try #1          Try #2          Try #3     Avg Latency
    0 sa-east-1       South America (São Paulo)         5.94 ms         5.42 ms         5.21 ms         5.52 ms
    1 eu-west-1       Europe (Ireland)                  5.36 ms         6.09 ms         5.40 ms         5.62 ms
    2 us-east-2       US-East (Ohio)                    6.59 ms         5.50 ms         4.85 ms         5.65 ms
    3 ap-northeast-2  Asia Pacific (Seoul)              6.30 ms         5.27 ms         5.49 ms         5.69 ms
    4 ap-south-1      Asia Pacific (Mumbai)             6.44 ms         5.46 ms         5.16 ms         5.69 ms
    5 us-west-1       US-West (California)              7.09 ms         5.21 ms         4.94 ms         5.75 ms
    6 ap-southeast-1  Asia Pacific (Singapore)          6.25 ms         5.51 ms         5.93 ms         5.89 ms
    7 us-east-1       US-East (Virginia)                6.73 ms         5.33 ms         5.64 ms         5.90 ms
    8 us-west-2       US-West (Oregon)                  6.19 ms         5.91 ms         5.70 ms         5.94 ms
    9 eu-central-1    Europe (Frankfurt)                6.63 ms         6.05 ms         5.42 ms         6.03 ms
   10 ap-southeast-2  Asia Pacific (Sydney)             7.18 ms         5.77 ms         5.96 ms         6.31 ms
   11 ap-northeast-1  Asia Pacific (Tokyo)              8.49 ms         5.02 ms         5.43 ms         6.31 ms

Perhaps docs need to be updated to explain what the 'TCP' test does (3 way handshake RTT to http endpoint), or make HTTP the default.

ekalinin commented 7 years ago

Hi atward,

Thanks for report. But your result is very strange. Here's my try from aws ec2 instance (m4.2xlarge) from Sydney region:

$ ./awsping -verbose 2 -repeats 3
      Code            Region                             Try #1          Try #2          Try #3     Avg Latency
    0 ap-southeast-2  Asia Pacific (Sydney)             1.36 ms         1.77 ms         1.91 ms         1.68 ms
    1 ap-northeast-1  Asia Pacific (Tokyo)            105.13 ms       105.76 ms       105.77 ms       105.55 ms
    2 ap-northeast-2  Asia Pacific (Seoul)            132.96 ms       132.98 ms       132.93 ms       132.96 ms
    3 us-west-1       US-West (California)            158.34 ms       156.92 ms       157.56 ms       157.61 ms
    4 us-west-2       US-West (Oregon)                161.97 ms       162.12 ms       161.85 ms       161.98 ms
    5 ap-southeast-1  Asia Pacific (Singapore)        169.35 ms       169.38 ms       169.37 ms       169.37 ms
    6 us-east-2       US-East (Ohio)                  208.23 ms       208.37 ms       207.82 ms       208.14 ms
    7 ap-south-1      Asia Pacific (Mumbai)           227.87 ms       227.83 ms       227.86 ms       227.86 ms
    8 us-east-1       US-East (Virginia)              233.17 ms       233.65 ms       233.26 ms       233.36 ms
    9 eu-west-1       Europe (Ireland)                299.22 ms       302.40 ms       304.86 ms       302.16 ms
   10 eu-central-1    Europe (Frankfurt)              310.09 ms       317.30 ms       310.51 ms       312.64 ms
   11 sa-east-1       South America (São Paulo)       341.90 ms       342.00 ms       341.60 ms       341.83 ms
atward commented 7 years ago

You're missing the key point: the transparent proxy

To replicate install squid, then add firewall rule: iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

TCP RTT would then report localhost->localhost, not the actual (HTTP request->response) RTT to the service.