Search code examples
amazon-web-servicesubuntuamazon-rdslatency

Test connection latency between Amazon RDS instance and external server


I need to test connection between a server located in my own datacenter and an Amazon RDS instance. I've tried with

time telnet <dns-of-my.instance> 3306

but it tracks the time since i've issued the command, until i've ended it, which is not relevant.

Are there any ways of measuring this?


Solution

  • My answer does not assume that ICMP ping is allowed, it uses TCP based measures. But you will have to ensure there are security group rules to allow access from the shell running the tests to the RDS instance

    First, ensure some useful packages are installed

    apt-get install netcat-openbsd traceroute
    

    Check that basic connectivity works to the database port. This example is for Oracle, ensure you use the endpoint and port from the console

        nc -vz dev-fulfil.cvxzodonju67.eu-west-1.rds.amazonaws.com 1521
    

    Then see what the latency is. The number you want is the final one (step 12)

    sudo tcptraceroute dev-fulfil.cvxzodonju67.eu-west-1.rds.amazonaws.com 1521
    
    traceroute to dev-fulfil.cvxzodonju67.eu-west-1.rds.amazonaws.com (10.32.21.12), 30 hops max, 60 byte packets
     1  pc-0-3.ioppublishing.com (172.16.0.3)  0.691 ms  3.341 ms  3.400 ms
     2  10.100.101.1 (10.100.101.1)  0.839 ms  0.828 ms  0.811 ms
     3  xe-10-2-0-12265.lon-001-score-1-re1.interoute.net (194.150.1.229)  10.591 ms  10.608 ms  10.592 ms
     4  ae0-0.lon-001-score-2-re0.claranet.net (84.233.200.190)  10.575 ms  10.668 ms  10.668 ms
     5  ae2-0.lon-004-score-1-re0.claranet.net (84.233.200.186)  12.708 ms  12.734 ms  12.717 ms
     6  169.254.254.6 (169.254.254.6)  12.673 ms * *
     7  169.254.254.1 (169.254.254.1)  10.623 ms  10.642 ms  10.823 ms
     8  * * *
     9  * * *
    10  * * *
    11  * * *
    12  * 10.32.21.12 (10.32.21.12) <syn,ack>  20.662 ms  21.305 ms
    

    A better measure of "latency" might be "the time a typical transaction takes with no or little data to transfer". To do this, write a script element that does this in a loop, maybe 1000 times and then time it with a high precision timer. But the exact details of this vary according to your needs