Load Balancer

Distributes requests across multiple backend endpoints.

Use the Load Balancer policy to distribute incoming traffic across multiple backend endpoints for higher availability and improved performance.

For more information on the policy parameter descriptions, see DataPower Nano Gateway documentation.

Example of a Load Balancer policy in code view.

kind: LoadBalancer
apiVersion: apim.ibm.com/v1
metadata:
  name: "invoke-single-backend"
  version: 1.0
  namespace: sample
spec:
    # Input and Output elements below are used to set the request and response context that will be used when involving the backend. 
    # Default request and response context will be used, if none is specified.  Different contexts can be set by specifying the context name. 
    # Any modifications to the context (changing the header, payload etc) are done using the transformation policies
    input : request # optional to set the request for the invoke
    output : response # optional to store response for the invoke
    # (1/2)
    roundRobinHttp:
       verb: "GET"
       statusException:
          - pattern: '500'
       endpoints:
          - endpoint:
              name: 'endpoint_1'
              tlsClientProfile: some_tls_profile
              url: 'https://localhost:3000'
              urlType: 'plain' # plain, variables, jsonata     
              version: HTTP/1.0 # HTTP/1.1, HTTP/2
              timeout: 60
              compressRequest: "br" # "gzip", "br", "deflate", "none"
              decompressResponse: false
              followRedirects: false
              chunkedUpload: false
              persistentConnections: true
            suspendTimeout: 300
          - endpoint:
              name: 'endpoint_2'
              tlsClientProfile: some_tls_profile
              url: 'https://localhost:4000'
              urlType: 'plain' # plain, variables, jsonata     
              version: HTTP/1.0 # HTTP/1.1, HTTP/2
              timeout: 60
              compressRequest: "br" # "gzip", "br", "deflate", "none"
              decompressResponse: false
              followRedirects: false
              chunkedUpload: false
              persistentConnections: true
            suspendTimeout: 300