Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 963
Alex Avatar asked Dec 05 '22 12:12

Alex


2 Answers

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

like image 164
Vorsprung Avatar answered Dec 08 '22 01:12

Vorsprung


Time the query. RDS must be hosting a SQL database server, so issue a trivial SQL query to it and time the execution.

For example, if your RDS instance is PostgreSQL, connect using psql and enable \timing.

psql -h myhost -U myuser

postgres=> \timing
Timing is on.
postgres=> SELECT 1;
 ?column?
----------
        1
(1 row)

Time: 14.168 ms

The latency is 14.168 ms in this example. Consult the manual for timing your specific SQL server implementation.

like image 43
Quolonel Questions Avatar answered Dec 08 '22 02:12

Quolonel Questions