0

I have the RDS server at Japan and two EC2 instances, one in the EU and the second in Japan.

I am running one application on the Japan EC2 instance which connects to the RDS (Japan). In this application I am simply selecting the data from the database in 200 threads simultaneously and it is working fine without any error.

But when I run the same application on the EU's EC2 instance with the 200 threads which contact to the RDS (Japan) at that time I get the following error..

System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.

Obviously, there will be network latency between the EU EC2 and Japan RDS.

Is there are any settings to help me to ignore this error and successfully contact 200 connections from EU's EC2 instance to the Japan RDS ?

1
  • Have you checked the number of connections available into your RDS server? I'd also check that the network can reach the RDS instance, timeout often means it can't reach the destination - check your security groups.
    – Tim
    Commented Dec 12, 2019 at 17:54

1 Answer 1

0

As you already mentioned, there's some network latency between EU and Japan. I guess most applications are not designed for such a setup - usually app servers and db servers are close to each other.

There are a couple of workarounds I could think of:

  • Increase the timeout setting in your application
  • Enable compression for the RDS connection
  • Use some kind of region-to-region replication, if this is feasible
  • In case you are running a web application, create a (http) proxy server in EU
  • Try Aurora, which supports cross-region replication

You must log in to answer this question.

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