An Azure service that delivers high availability and network performance to applications.
Hi Manakkal. Subash,
Thanks for reaching out in Microsoft Q&A forum,
Does Azure Load Balancer ensure that traffic from the same client IP always goes to the same backend across all rules, or does each rule keep its own independent session/persistence table?
- Each of those 33 load-balancing rules runs its own independent session persistence table with SourceIP (2-tuple hashing on source IP + destination IP). Even though your FTP control connection on port 21 and data connection on, say, 5015 come from the same client IP to the same ILB frontend IP, they hit different rules, so the LB treats them separately and picks backends independently. With two healthy pods, that's a coin flip per rule: control might land on Pod A, data on Pod B half the time, boomECONNREFUSED because only Pod A knows the FTP session state. Single replica? No split, everything works fine.
- Why exactly?: The hash is consistent within a single rule for repeat flows from that client on that port, but there's zero sharing across rules no global "this client IP always gets Pod A" mapping, even with the same backend pool. Floating IP helps with direct returns but doesn't bridge rules. Your corporate firewall might add SNAT quirks, but consistent source IP points squarely at per-rule isolation.
- Quick troubleshooting: Grab NSG flow logs or tcpdump on pods to see exactly which pod each connection hits by port. Test bumping to Default (5-tuple) mode for source-port affinity, though it's still per-rule and resets on new TCP handshakes.
- For fixes: App Gateway v2 with L7 cookie affinity handles cross-port stickiness way better. Or share FTP state across pods via Redis, proxy everything through one service, or just go SFTP on port 22 (stays in one rule). Standard ILB just isn't built for protocols like passive FTP that jump ports.
Reference:
- Configure Azure Load Balancer distribution mode - Azure Load Balancer | Microsoft Learn
- Azure Load Balancer distribution modes | Microsoft Learn
Kindly let us know if the above helps or you need further assistance on this issue.
Please do not forget to
and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.