1

This seems like the kind of thing that someone, at some point, would have extensively benchmarked. Specifically, what's the performance delta for connecting to an RDS PostgreSQL environment from an EC2 instance in the same AZ v. in a different AZ in the same region?

my specific case...

At the moment I'm working with a number of single-tenant environments running postgres RDS in one AZ, and a bunch of app containers spread across multiple AZs in that region. The application is asymmetric, so certain database-heavy services can only run on the "primary" app container. Many of these environments have the primary running in a different AZ from the database. I'm trying to determine whether it would be worth the risk and downtime of moving the databases currently on different AZs from the primary into the same AZ.

2
  • benchmarking? What's benchmarking??! ;-) Apr 24, 2018 at 16:37
  • Traffic inside an AZ is free, between AZs is charged, so there's a price advantage to being in the same AZ. How much it costs depends on your usage. The latency between AZs is typically 2-3ms, but with 90th percentile 20ms and 99th percentile 47ms, according to this blog. You really need to benchmark this with your application to determine the advantage.
    – Tim
    May 1, 2018 at 20:50

1 Answer 1

1

Having spoken to a few folks at AWS through their support and our account reps, they will tell you at a marketing level that you should always get around 1ms latency between AZ in the same region. Looking at Tim's comment this doesn't seem to be the case; but I've always primarily used us-west-2 for my applications.

There's a caveat. If you're only using the low-end instances like t2, you will likely have a lot of jitter and can sometimes encounter more latency.

If the instances are ENA (or SR-IOV) compatible, and using it, you'll get a big reduction in actual jitter and can realistically expect very low latency so long as you stay within the same VPC and region.

RDS specifically seems to be well optimized for networking, in the few years I've been using it (us-west-2) I've never had a single problem related to latency with the RDS instances themselves, but this is a N=1 data point.

Also... If you're using many instances connecting to one postgres server, make sure you're using pgbouncer or a similar connection pooler or you'll hit connection issues way before even a few ms of latency will cause problems.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .