- Newest
- Most votes
- Most comments
Thanks for reporting. Your issue together with the AI re:Post Agent answer helped my resolve an issue in our stack as well, which related to reconnection issues to Elasticache Memcached after upgrading to r8i.
This AWS article describes that most r8 instances are built on Nitro 6, which introduced this change:
Default TCP established timeout for idle TCP connections has been reduced from 432,000 seconds to 350 seconds.
Long story short: applications need to behave well with regards to TCP reconnection much better with the r8 hardware.
answered 6 months ago
The behavior you're experiencing on r8i/r8i-flex/m8i instances appears to be related to connection tracking and TCP idle timeout settings.
In AWS, TCP connections are tracked and will be closed if they remain idle (no data transmitted) for a specific period. For EC2 instances, the default TCP established idle timeout is 432,000 seconds (5 days), but this can vary based on instance types and configurations.
The consistent ~5 minute (approximately 300 seconds) disconnection you're seeing suggests that a TCP idle timeout is being enforced somewhere in your connection path. This could be due to differences in the underlying network infrastructure or default connection tracking configurations between the r7i and r8i/m8i instance families.
To address this issue, you have several options:
-
Implement WebSocket ping/pong frames or application-level heartbeats to keep the connection active by sending data periodically (before the 5-minute mark).
-
Adjust the TCP established timeout for your instances. You can modify the
tcpEstablishedTimeoutparameter in the ConnectionTrackingConfiguration for your Elastic network interfaces. This value can be set between 60 seconds and 432,000 seconds (5 days). -
Check if there are any differences in the network configuration between your instance generations that might be affecting connection tracking.
For WebSocket applications, it's generally a good practice to implement heartbeat mechanisms regardless of infrastructure, as various components in a network path might have different idle timeout policies.
Sources
ConnectionTrackingConfiguration - Amazon Elastic Compute Cloud
ConnectionTrackingSpecification - Amazon Elastic Compute Cloud
Introducing NLB TCP configurable idle timeout | Networking & Content Delivery
answered a year ago
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated 8 months ago

I am experiencing this issue as well when I migrated from m6i servers to m8i servers. Were you able to determine what the cause was?
We haven't found the root cause. Our migration is on hold for now. Any information others can provide about this behavior is appreciated.
After returning to this issue, it turns out Nitro v6 instance types use a different security-group connection tracking idle timeout. The default used to be 432000 seconds (5 days); on Nitro v6 it is now 350 seconds (about 5.8 minutes). AWS docs: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-connection-tracking.html.
The timeout can be set during instance creation: https://docs.aws.amazon.com/cli/latest/reference/ec2/run-instances.html, but I haven’t tested it yet.