- Newest
- Most votes
- Most comments
I suspect the answer is the network MTU - that is, the largest packet that the instances on either side are allowed to send to each other. In theory, the MTU should be automatically adjusted but this process may not work in some circumstances depending on a variety of factors.
It is pretty easy to test though: On at least one of the instances, set the MTU from what it is today to something lower such as 1500 or maybe even 1400 bytes. I can't give you more detailed instructions because your question does not say what operating system you're running. Note that the inter-region peering limit for peered VPCs is 1500 bytes but depending on the operating system you may have to specify a slightly lower number.
Note that within a region, larger packets are allowed which is why that is working for you. The reason that inter-region connections hang is because one instances (probably the database server) is trying to send a packet that is larger than the MTU (1500 bytes) and that packet is being dropped without feedback getting to the instance.
Ref: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/network_mtu.html
Hello Brettski, firstly thank you so much for your reply. actually, i have tested to run same query in a EC2 which is same region with mysql, everything is ok. If so, can it be still mysql instance MTU produced?
and if we assume it is MTU issue, based on my understanding, if the packet exceed MTU, it just split the packet to segment but why i meet hang? thank you again if you can check more for me? Appreciate it.
It hangs (and will eventually timeout) because packets are not getting through. In the same region, the MTU is larger which is why it works. I can't check your environment for you - only you have access to it. It is reasonable easy to change the MTU on most operating systems - Google for instructions based on the OS that you are using.
The issue you're experiencing with queries that return larger datasets (LIMIT 100) hanging while smaller queries (LIMIT 1, LIMIT 10) work fine is likely related to data size limitations rather than the VPC peering connection itself.
VPC peering connections don't typically impose data size restrictions. However, there are a few potential reasons for this behavior:
-
Network latency: Larger result sets take longer to transfer across regions, which could appear as a hang if the timeout is too short.
-
Application-level limitations: There might be a size limit in your application or the API you're using to execute the queries.
-
Database response size limit: Some database APIs have limits on the size of the result set they can return. For example, the Amazon Redshift Data API has a 100 MB limit on the result set returned by the database.
-
Network packet size: In rare cases, there could be issues with large network packets traversing the VPC peering connection, though this is unlikely to be the root cause.
To troubleshoot this issue:
-
Check for any timeout settings in your application and consider increasing them for cross-region queries.
-
Monitor the network performance and latency between the regions during query execution.
-
If possible, try executing the same queries directly on the RDS instance in region-B to isolate whether it's a network issue or a database issue.
-
Consider implementing pagination in your queries to retrieve large datasets in smaller chunks.
-
Review your application logs and database logs for any error messages or warnings related to data size or query execution.
If the issue persists after these steps, you may need to contact AWS support for further investigation, as they can provide more detailed analysis of your specific setup and any potential network or service-specific limitations.
Sources
Troubleshooting issues for Amazon Redshift Data API - Amazon Redshift
Cross-Region RDS Replica Not Syncing Existing Data | AWS re:Post
answered a year ago

i already try same query in a EC2 which deploy in the same region with database, everything works fine. So i believe we can exclude the mysql issue. Then, i still change the read/write timeout of application , set to 300 but it still fails.
Please check, Thank you