How do you tune TCP keepalives and idle timeouts across layers?
IntermediateProductionPerformance, Cost & Scale
Answer
Know each layer's idle timeout: NAT gateway 350s, NLB TCP 350s, ALB 60s default, Azure LB 4 min, many corporate firewalls 1 hour or less. Application keepalives should send before the shortest timeout.
sysctl -w net.ipv4.tcp_keepalive_time=240 net.ipv4.tcp_keepalive_intvl=30 net.ipv4.tcp_keepalive_probes=5
Silent drops of idle database connections after 350 seconds are a classic NAT-gateway symptom.
More on Performance, Cost & Scale
How do you reduce cross-AZ data transfer costs?IntermediateWhat are the main drivers of AWS network cost and how do you control each?IntermediateHow do you find what is driving a surprise NAT gateway bill?AdvancedHow do you tune Linux network settings for a high-traffic server?IntermediateHow do you reach 100k+ concurrent connections on one proxy?AdvancedHow do you choose instance types for network-heavy workloads on AWS?Intermediate