Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 馃幐 optional enable cross zone lb #88

Merged
merged 3 commits into from
Mar 27, 2024

Conversation

jaskaransarkaria
Copy link
Contributor

@jaskaransarkaria jaskaransarkaria commented Mar 26, 2024

Overview

This optimisation will only be disabled on the 'production-only' ingress

We can disable cross-zone load balancing because the nlb is created in each subnet, so traffic will still be able to reach each az. It is also worth mentioning that cross-zone load balancing for nlb is disabled by default.

When you enable an Availability Zone, you specify one subnet from that Availability Zone. Elastic Load Balancing creates a load balancer node in the Availability Zone and a network interface for the subnet (the description starts with "ELB net" and includes the name of the load balancer). Each load balancer node in the Availability Zone uses this network interface to get an IPv4 address
here

Diagram overview

disabled:

image

vs.

enabled:

image

Why

We want to be able to toggle cross-zone load balancing because it can introduce connection resets when a connection is mistakenly identified as originating from a duplicate source.

image

Disadvantages

The disadvantage of disabling cross-zone load balancing is if a client caches the DNS of the lb it could result in lbs receiving "disproportionally higher number of inbound requests"

Advantages

Benefits include fewer connection resets, marginally reduced latency (not crossing AZs) and reduced regional data transfer charges

$0.010 per GB - regional data transfer - in/out/between EC2 AZs or using elastic IPs or ELB # https://cloudiamo.com/2019/01/24/cross-zone-load-balancing-always-on-right/

Dig

You can see the nlb in each subnet az with dig below:

; <<>> DiG 9.10.6 <<>> a9a1fce6427fd49058c4c68e57fd8e75-e2e37f01a215aa62.elb.eu-west-2.amazonaws.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36420
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;a9a1fce6427fd49058c4c68e57fd8e75-e2e37f01a215aa62.elb.eu-west-2.amazonaws.com. IN A

;; ANSWER SECTION:
a9a1fce6427fd49058c4c68e57fd8e75-e2e37f01a215aa62.elb.eu-west-2.amazonaws.com. 60 IN A 13.42.229.97
a9a1fce6427fd49058c4c68e57fd8e75-e2e37f01a215aa62.elb.eu-west-2.amazonaws.com. 60 IN A 3.10.250.16
a9a1fce6427fd49058c4c68e57fd8e75-e2e37f01a215aa62.elb.eu-west-2.amazonaws.com. 60 IN A 18.135.147.246

;; Query time: 34 msec
;; SERVER: 100.64.9.0#53(100.64.9.0)
;; WHEN: Tue Mar 26 09:40:21 GMT 2024
;; MSG SIZE  rcvd: 154

variables.tf Outdated Show resolved Hide resolved
@jaskaransarkaria jaskaransarkaria merged commit 43f4c85 into main Mar 27, 2024
@jaskaransarkaria jaskaransarkaria deleted the optional-cross-zone-lb branch March 27, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants