{"id":3700,"date":"2022-11-28T13:51:26","date_gmt":"2022-11-28T05:51:26","guid":{"rendered":"https:\/\/tzlee.com\/blog\/?p=3700"},"modified":"2024-11-27T10:26:08","modified_gmt":"2024-11-27T02:26:08","slug":"are-network-load-balancers-faster","status":"publish","type":"post","link":"https:\/\/tzlee.com\/blog\/2022\/11\/are-network-load-balancers-faster\/","title":{"rendered":"Are Network Load Balancers Faster? A story on Engineering decisions."},"content":{"rendered":"\n<p id=\"0e01\">I was working on a project and an Engineer approached me after going through the AWS environment. He made a recommendation to switch from an Application Load Balancer (ALB) to a Network Load Balancer (NLB), and his reason was that the application may potentially receive high traffic and that the NLB has better performance.<\/p>\n\n\n\n<p id=\"ee52\">Well, he is not wrong because&nbsp;<a href=\"https:\/\/aws.amazon.com\/elasticloadbalancing\/features\/?nc=sn&amp;loc=2&amp;dn=1\" rel=\"noreferrer noopener\" target=\"_blank\">AWS\u2019s documentation states<\/a>:&nbsp;<em>\u201cIf extreme performance and static IP is needed\u2026 we recommend you use a Network Load Balancer.\u201d<\/em><\/p>\n\n\n\n<p id=\"1f08\">However, the statement from AWS concerns only the performance capabilities of the load balancer \u2014 it doesn\u2019t mean that your application as a whole would have better performance.<\/p>\n\n\n\n<p id=\"85c7\"><em>Whatttttt???<\/em>&nbsp;I\u2019m talking rubbish, right?<\/p>\n\n\n\n<p id=\"cd1e\">I used to work with a telco to build and maintain HTTP Load Balancers back in 2009. We were load balancing at its peak around 20 Gbps of HTTP traffic to a web cache farm sitting in the core of the telco\u2019s network. Web caches were really important for user experience because most of the web content that Singapore users consumed was overseas.<\/p>\n\n\n\n<p id=\"b6f6\">Serving up 20 Gbps of web traffic was a huge feat during that time \u2014 most PC still had 100 Mbps LAN, and we didn\u2019t even have fiber broadband in Singapore yet. We had around 40 web cache servers, each only capable of handling around 500\u2013600 Mbps of load. The bottleneck on the cache server was disk I\/O and CPU.<\/p>\n\n\n\n<p id=\"2d6e\">The optimizations that HTTP LBs do became very important. Good HTTP LBs advertise all sorts of fancy features for a reason (because people need them), but the most important bit is that it&nbsp;<strong>takes work away from the backend servers&nbsp;<\/strong>\u2014 the LBs we used back then (Citrix NetScaler) will multiplex multiple HTTP requests across a single TCP connection. This made a HUGE difference to the web cache server performance. Without this feature, each web cache can barely handle 100\u2013200Mbps of load because under millions of requests TCP connections are being set up and torn down. If you know how HTTP servers work, you will know that every TCP connection is a new thread which is an expensive operation.<\/p>\n\n\n\n<p id=\"583b\">A few years later, I was once again dealing with LBs for a US tech startup. At the peak, they were getting millions of API requests and their servers were struggling. I replaced traditional NLBs with ALBs and it reduced the load of the backend servers by 20\u201330%.<\/p>\n\n\n\n<p id=\"7be1\">In most cases, backend servers are already busy doing what it needs to do \u2014 business logic, database access, etc. What you\u2019d want is to have the LB offload any extra header processing, routing rules, redirection\/filtering, SSL, etc. so your servers don\u2019t have to. Another feature of an ALB is its ability to use more intelligent load distribution algorithms based on application-aware parameters such as HTTP headers, which can be very important with HTTP applications.<\/p>\n\n\n\n<p id=\"5eb2\">The Engineer made an assumption that an NLB will yield better performance \u2014 but we didn\u2019t have data, and didn\u2019t have an actual performance issue.<\/p>\n\n\n\n<p id=\"5eb2\"><strong>As Engineers, we need to know how to do work with\u00a0meaningful impact and outcomes\u00a0and\u00a0avoid trying to prematurely optimize\u00a0based on assumptions.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was working on a project and an Engineer approached me after going through the AWS environment. He made a recommendation to switch from an Application Load Balancer (ALB) to a Network Load Balancer (NLB), and his reason was that&#8230; <a class=\"more-link\" href=\"https:\/\/tzlee.com\/blog\/2022\/11\/are-network-load-balancers-faster\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":3736,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[8],"tags":[637,636],"class_list":["post-3700","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech","tag-aws","tag-engineering"],"jetpack_featured_media_url":"https:\/\/tzlee.com\/blog\/wp-content\/uploads\/2022\/11\/pexels-brett-sayles-4818711-scaled.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/3700","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/comments?post=3700"}],"version-history":[{"count":3,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/3700\/revisions"}],"predecessor-version":[{"id":3735,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/posts\/3700\/revisions\/3735"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/media\/3736"}],"wp:attachment":[{"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/media?parent=3700"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/categories?post=3700"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tzlee.com\/blog\/wp-json\/wp\/v2\/tags?post=3700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}