of 36

AWS Atlanta meetup load-balancing

These slides are from the September 2017 group about the 3 types of Load Balancers in AWS - Classic Load Balancer, Application Load Balancer, and Network Load Balancer
12 views36 pages
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Documenttranscript
  • 1. ELB on AWS A look at the 3 load balancers on AWS
  • 2. Sponsors
  • 3. Find me on LinkedIn LDAP on AWS Presented by Adam Book
  • 4. Comparison of Load Balancers
  • 5. Comparison Chart Classic ELB Application Load Balancer Network Load Balancer Load Balancing Round Robin Round-robin only, with cookie-based session persistence Protocols TCP, SSL, HTTP(S) HTTP & HTTPS TCP SSL Support YES Multiple Applications Sticky Sessions Static IP Monitoring Cloud Watch Cloud Watch Cloud Watch
  • 6. Comparison of Load Balancers Pricing Us-east-1 us-east-2 EU (Ireland) Asia Pacific (Sydney) Classic Load Balancer $0.025 per hr $0.008 per GB data $0.028 per hr $0.008 per GB of data $0.028 per hr $0.008 per GB of data Application Load Balancer $0.0225 per hr $0.008 per LCU-hour $0.0252 per hr $0.008 per LCU-hour $0.0252 per hr $0.008 per LCU-hour Network Load Balancer $0.0225 per hr $0.006 per LCU-hour $0.0252 per hr $0.006 per LCU-hour $0.0252 per hr $0.006 per LCU-hour
  • 7. What is an LCU? LCU Details An LCU measures the dimensions on which the Application Load Balancer processes your traffic (averaged over an hour). The four dimensions measured are: • New connections: Number of newly established connections per second. Typically, many requests are sent per connection. • Active connections: Number of active connections per minute. • Bandwidth: The amount of traffic processed by the load balancer in Mbps • Rule evaluations: It is the product of number of rules processed by your load balancer and the request rate. The first 10 processed rules are free (Rule evaluations = Request rate * (Number of rules processed - 10 free rules)
  • 8. What is an LCU? Network Load Balancer LCU Details An LCU measures the dimensions on which the Network Load Balancer processes your traffic (averaged over an hour). The three dimensions measured are: • New connections or flows: Number of newly established connections per second. Many technologies (HTTP, WebSockets, etc.) reuse TCP connections for efficiency. The number of new connections is typically lower than your request or message count. • Active connections or flows: Number of active connections per minute. • Bandwidth: The amount of traffic processed by the load balancer in Mbps .
  • 9. Classic Load Balancer Support for EC2—Classic Support for TCP and SSL listeners Support for sticky sessions using application-generated cookies Round Robin Algorithm No need to create Target Groups One application per ELB
  • 10. Application Load Balancer It’s a feature rich layer 7 load balancing platform Allows you to define routing rules based on the content of the request The Application Load Balancer will make sure that traffic gets routed to your ordering service wherever it is running including dynamic ports on containers ALB supports Enhanced Metrics and Health checks vs Classic ELB. Content based routing which allows requests to be routed to different appliations behind a single load balancer
  • 11. Application Load Balancer Instances can be registered with multiple ports, allowing for requests to be routed to multiple containers on a single instance Amazon ECS will automatically register tasks with the load balancer using dynamic port mapping ALB can also be used with other container technologies.
  • 12. ALB Architecture Availability Zone Availability Zone Auto Scaling group Auto Scaling group Auto Scaling group www.buymyhouse.com /financing /for_sale /cash4houses
  • 13. ALB Architecture (with containers) Availability Zone Availability Zone Auto Scaling group Auto Scaling group Auto Scaling group domain.com app1 app2 app3
  • 14. Setting up an ALB 1. Create the Application Load Balancer 2. Create a Target Group 3. Register Targets with the Target Group 4. Create a Listener with the default Rule that forwards requests to the default group 5. Create a Listener that forwards requests to the previously created target group.
  • 15. Understanding Target Groups Logical grouping of targets behind a load balancer Target groups can exist independently from a load balancer and then be associated with a load balancer when needed. Regional construct that can be associated with an AutoScaling Group
  • 16. Understanding Target Groups Target Group #1 Target Group #3 Target Group #3 Health Check Health Check Health Check Listener Listener Load Balancer Rule (default) Rule app 2Rule app 1
  • 17. Understanding Target Groups To create a target group we must specify: • a name • A protocol • A port • A vpc id aws elbv2 create-target-group –name financing –protocol HTTP –port 80 –vpc vpc- 66a268f0
  • 18. Creating a Target Group Creating the target group through the console gives you the dialog like shown
  • 19. Creating the ALB
  • 20. Creating the ALB
  • 21. Register targets The final step is to register targets with the ALB
  • 22. Setting up an ALB You must choose at least 2 AZs when setting up an ALB You need to choose security groups Listeners will be of type HTTP or HTTPs (or both) You need to register targets in order for the ALB to serve traffic to them.
  • 23. Creating a Target Group Creating the target group through terraform is done like the HML shown above resource "aws_alb_target_group" ”TestGroup" { name = "tf-testgroup-alb-tg" port = 80 protocol = "HTTP" vpc_id = "${aws_vpc.default.id}" } resource "aws_vpc" ”default" { cidr_block = "10.0.0.0/16" }
  • 24. Creating a Target Group Creating the target group through CloudFormation (YAML) TargetGroup: Type: AWS::ElasticLoadBalancingV2::TargetGroup Properties: HealthCheckIntervalSeconds: 30 HealthCheckProtocol: HTTPS HealthCheckTimeoutSeconds: 10 HealthyThresholdCount: 4 Matcher: HttpCode: '200' Name: MyTargets Port: 10 Protocol: HTTPS TargetGroupAttributes: - Key: deregistration_delay.timeout_seconds Value: '20' Targets: - Id: Ref: Instance1 Port: 80 - Id: Ref: Instance2 Port: 80 UnhealthyThresholdCount: 3 VpcId: Ref: VPC Tags: - Key: key Value: value - Key: key2 Value: value2
  • 25. Network Load Balancer Static IP Address – Each NLB provideds a single IP address for each VPC subnet. Zonality – The IP-per subnet feature reduces latency with improved performance Source Address Preservation – With NLB, the origional source IP address and source ports for the incoming connections remain unmodified so Long Running Connections – NLB handles connections with built-in fault tolerance, and can handle connections that are open for months or years. This makes them a great fit for IoT, gaming and messaging applications. Failover – Powered by Route 53 health checks, NLB supports failover between addresses within and across regions.
  • 26. Setting up an NLB 1. Create the Network Load Balancer 2. Create the Name 3. Choose internet-facing or Internal 4. Create a Listener with the default Rule that forwards requests to the default group 5. Create a Listener that forwards requests to the previously created target group. NOTE: you need a number of free EIPs per Availability zone that you are going to have the NLB.
  • 27. Setting up an NLB
  • 28. Setting up an NLB
  • 29. Setting up an NLB
  • 30. Setting up an NLB Select the box next to the instance(s) you want to register on the NLB
  • 31. Setting up an NLB We can now go to our NLB at the DNS name above
  • 32. Monitoring NLB Using apache bench: ab -n 100 -c 3 http://NLBtest-fb8e6d453c4cfeeb.elb.us-east- 1.amazonaws.com/#welcome
  • 33. Items of interest http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateLoadBala ncer.html If you are trying to run things programatically then make sure that you are looking for elbv2 Using Programmatic tools: aws elbv2 create-load-balancer --name my-load-balancer --type network --subnets subnet- 12345678 Type The type of load balancer to create. The default is application. Type: String Valid Values: application | network Required: No
  • 34. Migrating from Classic ELB git clone https://github.com/aws/elastic-load-balancing-tools.git If you would like to migrate your classic ELB to a new ALB or NLB then there is a Github project out there to do this: Elastic-load-balancing-tools
  • 35. Questions? Image by http://www.gratisography.com/
  • 36. Interested in Sponsoring AWS Atlanta? Image by http://www.gratisography.com/
  • Advertisement
    MostRelated
    View more
    We Need Your Support
    Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

    Thanks to everyone for your continued support.

    No, Thanks
    SAVE OUR EARTH

    We need your sign to support Project to invent "SMART AND CONTROLLABLE REFLECTIVE BALLOONS" to cover the Sun and Save Our Earth.

    More details...

    Sign Now!

    We are very appreciated for your Prompt Action!

    x