3 tier application - slow IO latency between RDS and EC2


Hello, I've recently re-architected my application, which is written in Ruby on Rails and uses a PostgreSQL 13 database, from a setup where everything was in public networks, as shown in the attached diagram (2x EC2 instances and an RDS instance), to a 3-tier architecture. I've separated everything into public and two private networks, also as shown in the attached diagram. Everything is working fine, but I've encountered an issue with the speed of data loading/retrieval from the database. I've noticed that the IO latency has increased to as much as 25 milliseconds, whereas in the previous setup it was around 2-4 milliseconds. I've tried upgrading the RDS instance to a more powerful one with a larger CPU, but this hasn't helped. What could be the reason for this behavior? Enter image description here
Enter image description here

preguntada hace 5 días76 visualizaciones
2 Respuestas


Were EC2 and RDS originally running in the same subnet?
Looking at the configuration diagram, the subnets are separated and communication occurs between AZs.
Communication between AZs will result in a difference in performance compared to communication within the same AZ.
You can perform a simple benchmark test by following the steps in the document below, which may be helpful.

Additionally, IO performance may be improved somewhat by changing the RDS storage settings.

profile picture
respondido hace 5 días
  • Since NAT Gateway is not used for communication within the VPC, I don't think it is related to communication latency between EC2 and RDS. I suspect that latency is occurring in communication between subnets in different AZs.


@Riku_Kobayashi So the first infrastructure was all in one subdomain. I tried to move the new one to one Azs to eu-cental-1b but it didn't help. There are still EC2 and rds in different subdomains. Can the fact that they are in private networks and EC2 uses a NAT gateway to communicate with the Internet have an impact on latency?

respondido hace 5 días

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas