# Features

## Sticky Sessions

* Allows a user to be redirected to same EC2 instance, behind the load balancer.
* Supported by CLB, ALB and NLB _(NLB does not use cookies)_.
* It uses a cookie with an expiration date, to achieve this functionality.
* Primarily used for session maintenance.
* There are two types of cookies
  * **Application based cookie**
    * **Custom cookie**
      * Generated by application.
      * Name must be specified for each target group.
      * Cookie name must not be `AWSALBAPP`, `AWSALBTG` or `AWSALB` as these are reserved names for ELB.
    * **Application cookie**
      * Cookie name is `AWSALBAPP`.
      * Generated by load balancer.
  * **Duration based cookie**
    * **Cookie name** : `AWSALB` for `ALB` and `AWSELB` for `CLB`.
    * Generated by load balancer.
* Duration of cookie is between 1 second and 7 days.

## Cross-Zone Load balancing

* This feature allows traffic to be evenly distributed across all AZ registered instances, and not on the node of elastic load balancer.

|                                                                                         Cross-Zone load balancing enabled                                                                                         |                                                                                          Cross-Zone load balancing disabled                                                                                         |
| :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| ![enabled](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-96b6d3c29ac43105bcdf965bdb5084a5febc2a71%2FCZLB_enabled.png?alt=media) | ![disabled](https://574639531-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJDnjsv52I3fJ56WbLgHu%2Fuploads%2Fgit-blob-8bbf32a68c9cd1527aefd977aaf0dafb8525638f%2FCZLB_disabled.png?alt=media) |

* Feature status based on ELB type

|                  Feature                 |                                                     ALB                                                    |         NLB         |         GWLB        |                  CLB                  |
| :--------------------------------------: | :--------------------------------------------------------------------------------------------------------: | :-----------------: | :-----------------: | :-----------------------------------: |
| Cross-Zone load balancing default config | Enabled by default, cant be disabled at Elastic load balancer level. Can be disabled at target group level | Disabled by default | Disabled by default |          Disabled by default          |
|                  Charged                 |                                    No charges for inter AZ data transfer                                   |    Pay as you use   |    Pay as you use   | No charges for inter AZ data transfer |

## Connection Draining

* Connection Draining is the term used for `CLB`. AKA Deregistration-Delay for `ALB`/`NLB`.
* Time to complete inflight-request, while instance is marked unhealthy or deregistered.
* Once an EC2 instance is in deregistering stage, ELB will stop sending request to deregistered instance/s.
* By default 300 seconds is the connection draining duration, but can be configured between 1 to 3600 seconds.
* It can be disabled by setting the parameter to 0. Note that lower the duration value, the sooner the instance will be taken down.
