Load Balancing

Overview

In case of high volume application traffic which must be distributed between multiple VM instances, Zadara Cloud Services supports the definition of load balancers and target groups. Load balancers distribute the load between the VM instances defined in the target group. This capability provides the following benefits when compared to working with individual VM instances:

  • Time required to complete a task is reduced.

  • Fault tolerance and high availability can be provided in case of VM instance failure.

When you create a load balancer, you define a target group of instances that will share the work of processing requests from an application. The application then directs its requests to the load balancer, and the load balancer distributes the work among the instances in the load balancer’s target group.

See the video demonstrating the basics of creating and configuring zCompute Load Balancers, Target Groups and Listeners:

Note

The load balancing capability must be globally enabled and configured by a system administrator, before load balancers can be created and used.

Load Balancer

Creating a Load Balancer

To create a load balancer:

  1. Navigate to Home > Load Balancing > Load Balancers. The list of currently defined load balancers is displayed.

  2. To create a new load balancer, click + Create from the top toolbar.

  3. In the Create Load Balancer dialog which opens, enter the following:

    1. Name: The new load balancer’s name.

    2. Description: An optional description for the load balancer.

    3. Type: The load balancer type determines the basis on which the load balancing is done. The following types are supported:

      • ALB: Application Load Balancer does distribution between targets based on HTTP/HTTPS sessions.

      • NLB: Network Load Balancer does distribution between targets based on TCP sessions regardless of the application layer protocol.

    4. VPC: From the dropdown, select the VPC to be associated with the load balancer.

    5. Subnet: From the dropdown, select an existing subnet to be associated with the load balancer, or click + to define a new subnet.

    6. Elastic IP: From the dropdown, select an existing Elastic IP to be associated with load balancer, or click + to define a new Elastic IP.

    7. Security Group: Determine the Security Groups that are associated with the load balancer, on the basis of the following selection:

      • Standard: To select Security Groups that are created and managed by the user and can be updated at any time. It’s the user responsibility to open the listeners’ ports and to restrict to specific sources if required.

        From the dropdown, select existing Security Groups to be associated with load balancer, or click + to define and associate a new group.

      • Managed: To select Security Groups that are created and managed by the Load Balancer service. Listeners’ ports will be automatically open to any incoming source.

      Note

      This setting can’t be changed after the load balancer creation.

    8. Instance Type: From the dropdown, select the instance type (CPU, RAM, boot disk size) to be associated with load balancer and to cope with the expected load.

    9. IP Address: Optional <place holder>

    10. High Availability: Check or uncheck the high availability option. When selected, additional load balancers will be created for standby, to automatically replace a failed load balancer.

    11. Tags: Enter tags that can be used for ease of identifying the load balancer and as a filter in searches.

  4. Click Finish.

Note

When you create a load balancer instance, the system creates a number of internal resources (including a VM). These are considered “protected resources.” To preserve the integrity of the load balancer instance, the system prevents you from deleting or modifying these resources.

Target Groups

A target group is a group of instances to which a load balancer directs application traffic. The instances in this group collectively do the processing work that the application requires.

Creating a Target Group

To create a target group:

  1. Navigate to Home > Load Balancing > Target Groups.

    The list of currently defined target groups is displayed.

  2. To create a new target group, click + Create from the top toolbar.

    The Create Target Group dialog will open.

    1. In the Details tab, enter the following:

      1. Name: The name of the new target group.

      2. Description: Optional description of the new target group.

      3. Protocol: Select the protocol used by the load balancer to access the target group.

        • HTTP: For an Application Load Balancer (ALB).

        • TCP: For a Network Load Balancer (NLB).

      4. Default Port: The target group port used by the load balancer to connect to this target group.

      5. Sticky Session - By default, a load balancer routes each request independently to the registered target group instance with the smallest load. However, you can use the sticky session feature to bind a user’s session to a specific instance. This ensures that all requests from the user during the session are sent to the same instance.

        1. Duration - if sticky session is selected, enter session duration in seconds during which load balancer should consistently route the user’s request to the same VM instance.

    2. Click Next.

    3. The Health Check tab configurations are used by the load balancer to determine whether the target is healthy:

      1. Port:

        • Traffic Port: The health check connection will be established on the port where the target accepts incoming traffic.

        • Custom: The health check connection will be established on a specified port for all targets in the group.

          Enter the Custom port number.

      2. Interval: The interval in seconds between health checks of an individual VM instance.

        • Minimum: 5 seconds.

        • Maximum: 300 seconds.

      3. Timeout: The time in seconds beyond which no response means a failed health check. The value must be less than the interval’s maximum value.

        • Minimum: 2 seconds.

        • Maximum: 60 seconds.

      4. Healthy Threshold: The number of consecutive successful health checks needed to transition a VM instance to the healthy state.

        • Minimum: 2 seconds.

        • Maximum: 10 seconds.

      5. Unhealthy Threshold: The number of consecutive failed health checks needed to transition a VM instance to the failed state.

        • Minimum: 2 seconds.

        • Maximum: 10 seconds.

      6. HTTP Health Check: For health checks using the HTTP protocol, configure the following:

        1. Path: The ping path used by the load balancer to do a health check on VM instances in the target group.

        2. HTTP Code(s): The HTTP health check response codes that determine a successful health check, and therefore a healthy target.

          The following formats are supported:

          • A single HTTP success code, for example, 200.

          • Multiple HTTP success codes separated by commas, for example 200,301.

          • A range of HTTP success codes, specified with “-” between the first and last code in the range, for example, 200-399.

        3. Click Next.

    4. In the Targets tab, add targets to the group.

      • Target Type: Select the Target Type, click Add, and enter the target’s parameters.

        Note

        All targets in a Target Group must be of the same Target Type.

        The following Target Types are supported:

        • Instance:

          Enter the Instance type target’s parameters:

          1. Select Target VM: From the dropdown, select a target VM instance.

          2. Port: Specify the port number on the target for communication with the load balancer.

        • IP:

          Enter the IP type target’s parameters:

          1. IP: Enter the target’s IP address, that is both in your region and is reachable from the load balancer.

          2. Port: Specify the port number on the target for communication with the load balancer.

      1. To configure additional targets in the Target Group click Add, and enter the target’s parameters according to the Target Type.

      2. Click Finish.

Listeners

A listener is a process that monitors a specified port for incoming connection requests. The listener’s rules determine how the load balancer routes these requests to the targets.

Every load balancer requires at least one listener, each of which must have one or more rules.

A listener’s rule consists of a condition and a resulting action. When the condition is met, the load balancer executes the corresponding action for that rule.

When multiple rules are configured for a listener, they are evaluated sequentially based on their order. If the condition of the first rule is not met, the subsequent rules are assessed in turn. When a rule’s condition is met and its corresponding action executed, no further subsequent rule is assessed for the incoming connection request. The final rule in the sequence includes a default condition indicating that none of the preceding rules matched the incoming request, and the load balancer will execute its corresponding action.

The order of all the rules except for the final one can be changed by dragging and dropping a rule into its preferred position in the sequence.

Creating a Listener

There are some differences in listener configuration options, depending on the type of load balancer:

Creating a Listener for NLB type Load Balancer

  1. Navigate to Home > Load Balancing > Target Groups.

    The list of currently defined target groups is displayed.

  2. Select the NLB type load balancer for which the listener is being created.

  3. In the load balancer’s lower pane’s Listeners tab, click + Create.

  4. In the Create Listener dialog:

    1. Protocol: The Protocol is set to TCP and cannot be modified.

    2. Port: Enter the listener’s port.

    3. Rule:

      Note

      • It is not possible to create multiple rules for an NLB type load balancer’s listener. Only the default rule is applicable and required. As a sole required rule, there is no condition for assessment.

      • The resulting Action is to Forward the incoming requests to a selected Target Group.

      1. Action: The rule’s Action is to Forward the incoming requests to the Target Group specified in Forward to below. The Action cannot be modified for an NLB type load balancer’s rule.

      2. Forward to: Select the destination Target Group from the dropdown, or click + to create a new one.

        See Creating a Target Group.

    4. Click Finish.

Creating a Listener for ALB type Load Balancer

  1. Navigate to Home > Load Balancing > Target Groups.

    The list of currently defined target groups is displayed.

  2. Select the ALB type load balancer for which the listener is being created.

  3. In the load balancer’s lower pane’s Listeners tab, click + Create.

  4. In the Create Listener dialog:

    1. Protocol: Select HTTP or HTTPS.

      For HTTPS, select or upload a Default SSL Certificate.

    2. Port: Enter the listener’s port.

    3. Rules

      1. Define the listener’s rules, starting with the default rule’s action:

      2. To create additional rules, click +Add Rule.

        1. Click + Add Condition, select one of the conditions from the dropdown and enter its parameter values:

          Condition

          Parameter values

          Header

          Header name and value patterns

          Path

          Path patterns

          Host

          Host names

          Method

          One or more of the HTTP methods:

          • GET

          • HEAD

          • POST

          • PUT

          • PATCH

          • DELETE

          • OPTIONS

          IP

          The CIDR blocks that contain the source IP addresses.

          Click Add CIDR to add another CIDR block.

        2. Click + Add Condition to add another condition to the same rule.

          Note

          Multiple conditions can be configured in a single rule for a listener of an ALB type load balancer.

        3. Action: Configure the rule’s action, corresponding to the condition.

          Select the applicable action, and enter its parameter values:

          Action

          Parameter values

          Forward

          Forward to: Select the destination target group

          Fixed Response

          • Status Code The HTTP status code value

          • Send Content (optional).

            If selected, for Content Type select one of:

            • text/plain

            • text/css

            • text/html

            • application/javascript

            • application/json

          • Response body: Upload the response body file,

            up to a maximum size of 1 KB

          Redirect

          • Protocol: Leave it Unchanged, or select HTTP or HTTPS

          • Port: Enter the target port number, or select Unchanged

            to default to the target’s original configured port

          • Path: The redirect URL that must be sent to the client’s browser

          • Query: The query portion of the redirect URL

          • Status Code:

            • 301 (Moved Permanently)

            • 302 (Moved Temporarily)

      3. To create an additional rule, click +Add Rule.

    4. Click Finish.