-
Overview
- Internal HTTP(S) Load Balancing supports advanced traffic management functionality
- Intelligently route traffic based on HTTP(S) parameters (host, path, headers, and other request parameters)
- Perform request-based and response-based actions (redirects and header transformations)
- Fine-tunes load balancing behavior based on traffic policies (advanced load balancing algorithms)
-
Traffic steering
- Traffic steering allows users to direct traffic to service instances based on HTTPS parameters such as request headers
- If a user's device is a mobile device with user-agent:Mobile in the request header, traffic steering can send that traffic to service instances designated to handle mobile traffic
-
Traffic actions
- Internal HTTP(S) Load Balancing allows users to define percentage-based traffic splits across multiple backend services
- Users can send 95% of the traffic to the previous version of the service and 5% to the new version of the service
- After users validated that the new production version works as expected, users can gradually shift the percentages until 100% of the traffic reaches the new version of the service
- Traffic splitting is typically used for deploying new versions, A/B testing, service migration, and similar processes
-
Traffic policies
- The organization might have specific compliance requirements mandating that all traffic be mirrored to an additional service that can, for example, record the request details in a database for later replay
- Set up traffic policies using regional backend services
-
Traffic management components
- Internal HTTP(S) load balancers provide traffic management by leveraging regional URL maps and regional backend services resources
- Users can set up traffic steering and traffic actions by using regional URL maps
- Google Cloud resources that are associated with URL maps include route rule, rule match and rule actions
-
Google Cloud resources that are associated with backend services include
- Locality load balancer policy
- Consistent hash load balancer settings
- Circuit breakers
- Outlier detection
-
Routing requests to backends
- In Internal HTTP(S) Load Balancing, the backend for traffic is determined using a two-phased approach
- The load balancer selects a backend service with backends
- The backends can be Compute Engine virtual machine (VM) instances in an unmanaged instance group, Compute Engine VMs in a managed instance group (MIG), or containers by means of a Google Kubernetes Engine (GKE) node in a network endpoint group (NEG)
- The load balancer chooses a backend service based on rules defined in a regional URL map
- The backend service selects a backend instance based on policies defined in a regional backend service
- For each URL map, choose to use simple host and path rules or advanced host, path, and route rules
- The two modes are mutually exclusively.
- Advanced host, path, and route rules provide additional configuration options compared to simple host and path rules
- Route rules have an associated priority value and are interpreted in priority order (rather than by using longest-path-matches-first semantics)
-
Host rules
- When a request reaches the load balancer, the request's host field is evaluated against the hostRules defined in the URL map
- Each host rule consists of a list of one or more hosts and a single path matcher (pathMatcher)
- If no hostRules are defined, the request is routed to the defaultService
-
Path matchers
- After a request matches a host rule, the load balancer evaluates the path matcher corresponding to the host
-
A path matcher is made up of
- One or more path rules (pathRules) or route rules (routeRules)
- A default service (defaultService), which is the default backend service that is used when no other backend services match
-
Path rules
- Path rules (pathRules) specify one or more URL paths, such as / or /video
- Path rules are generally intended for the type of simple host and path-based routing
-
Route rules
- A route rule (routeRules) matches information in an incoming request and makes a routing decision based on the match
- Route rules can contain a variety of different match rules (matchRules) and a variety of different route actions (routeAction)
- A match rule evaluates the incoming request based on the HTTP(S) request's path, headers, and query parameters.
- Match rules support various types of matches (prefix match) as well as modifiers (case insensitivity)
- This enables users to send HTTP(S) requests to a set of backends based on the presence of a custom-defined HTTP header
- Match rules (matchRules) match one or more attributes of a request and take actions specified in the route rule
-
Traffic policies
- Traffic policies enable fine-tuned load balancing within an instance group or network endpoint group (NEG)
- Policies only take effect after a backend service has been selected by using regional URL map
-
Traffic policies enable users to
- Control the load balancing algorithm among instances within the backend service
- Control the volume of connections to an upstream service
- Control the eviction of unhealthy hosts from a backend service