---
title: "Creates or Updates MeshLoadBalancingStrategy entity"
method: PUT
path: "/v1/mesh/control-planes/{cpId}/api/meshes/{mesh}/meshloadbalancingstrategies/{name}"
tags: ["MeshLoadBalancingStrategy"]
---

# Creates or Updates MeshLoadBalancingStrategy entity

`PUT /v1/mesh/control-planes/{cpId}/api/meshes/{mesh}/meshloadbalancingstrategies/{name}`

## Request

- Base URL: `https://global.api.konghq.com`
- URL: `https://global.api.konghq.com/v1/mesh/control-planes/{cpId}/api/meshes/{mesh}/meshloadbalancingstrategies/{name}`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

## Path parameters

- `mesh` string, required
- `name` string, required

## Request body

- MeshLoadBalancingStrategyItem: MeshLoadBalancingStrategy configures how traffic is distributed across service instances. It supports multiple load balancing algorithms (round-robin, least request, ring hash, random, maglev), locality-aware routing to prefer nearby instances, and cross-zone failover strategies for high availability.
  - `type` 'MeshLoadBalancingStrategy', required: the type of the resource
  - `mesh` string: Mesh is the name of the Kuma mesh this resource belongs to. It may be omitted for cluster-scoped resources.
  - `kri` string: A unique identifier for this resource instance used by internal tooling and integrations. Typically derived from resource attributes and may be used for cross-references or indexing
  - `name` string, required: Name of the Kuma resource
  - `labels` object: The labels to help identity resources
  - `spec` object, required: Spec is the specification of the Kuma MeshLoadBalancingStrategy resource.
    - `targetRef` object: TargetRef is a reference to the resource the policy takes an effect on. The resource could be either a real store object or virtual resource defined inplace.
      - `kind` 'Mesh' | 'MeshSubset' | 'MeshGateway' | 'MeshService' | 'MeshExternalService' | 'MeshMultiZoneService' | 'MeshServiceSubset' | 'MeshHTTPRoute' | 'Dataplane', required: Kind of the referenced resource
      - `labels` object: Labels are used to select group of MeshServices that match labels. Either Labels or Name and Namespace can be used.
      - `mesh` string: Mesh is reserved for future use to identify cross mesh resources.
      - `name` string: Name of the referenced resource. Can only be used with kinds: `MeshService`, `MeshServiceSubset` and `MeshGatewayRoute`
      - `namespace` string: Namespace specifies the namespace of target resource. If empty only resources in policy namespace will be targeted.
      - `proxyTypes` string[]: ProxyTypes specifies the data plane types that are subject to the policy. When not specified, all data plane types are targeted by the policy.
      - `sectionName` string: SectionName is used to target specific section of resource. For example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.
      - `tags` object: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset`
    - `to` object[]: To list makes a match between the consumed services and corresponding configurations
      - `default` object: Default is a configuration specific to the group of destinations referenced in 'targetRef'
        - `hashPolicies` object[]: HashPolicies specify a list of request/connection properties that are used to calculate a hash. These hash policies are executed in the specified order. If a hash policy has the “terminal” attribute set to true, and there is already a hash generated, the hash is returned immediately, ignoring the rest of the hash policy list.
          - `connection` object
            - `sourceIP` boolean: Hash on source IP address.
          - `cookie` object
            - `name` string, required: The name of the cookie that will be used to obtain the hash key.
            - `path` string: The name of the path for the cookie.
            - `ttl` string: If specified, a cookie with the TTL will be generated if the cookie is not present.
          - `filterState` object
            - `key` string, required: The name of the Object in the per-request filterState, which is an Envoy::Hashable object. If there is no data associated with the key, or the stored object is not Envoy::Hashable, no hash will be produced.
          - `header` object
            - `name` string, required: The name of the request header that will be used to obtain the hash key.
          - `queryParameter` object
            - `name` string, required: The name of the URL query parameter that will be used to obtain the hash key. If the parameter is not present, no hash will be produced. Query parameter names are case-sensitive.
          - `terminal` boolean: Terminal is a flag that short-circuits the hash computing. This field provides a ‘fallback’ style of configuration: “if a terminal policy doesn’t work, fallback to rest of the policy list”, it saves time when the terminal policy works. If true, and there is already a hash computed, ignore rest of the list of hash polices.
          - `type` 'Header' | 'Cookie' | 'Connection' | 'SourceIP' | 'QueryParameter' | 'FilterState', required
        - `loadBalancer` object: LoadBalancer allows to specify load balancing algorithm.
          - `leastRequest` object: LeastRequest selects N random available hosts as specified in 'choiceCount' (2 by default) and picks the host which has the fewest active requests
            - `activeRequestBias` union: ActiveRequestBias refers to dynamic weights applied when hosts have varying load balancing weights. A higher value here aggressively reduces the weight of endpoints that are currently handling active requests. In essence, the higher the ActiveRequestBias value, the more forcefully it reduces the load balancing weight of endpoints that are actively serving requests.
              - …
            - `choiceCount` integer: ChoiceCount is the number of random healthy hosts from which the host with the fewest active requests will be chosen. Defaults to 2 so that Envoy performs two-choice selection if the field is not set.
          - `maglev` object: Maglev implements consistent hashing to upstream hosts. Maglev can be used as a drop in replacement for the ring hash load balancer any place in which consistent hashing is desired.
            - `hashPolicies` object[]: HashPolicies specify a list of request/connection properties that are used to calculate a hash. These hash policies are executed in the specified order. If a hash policy has the “terminal” attribute set to true, and there is already a hash generated, the hash is returned immediately, ignoring the rest of the hash policy list.
              - …
            - `tableSize` integer: The table size for Maglev hashing. Maglev aims for “minimal disruption” rather than an absolute guarantee. Minimal disruption means that when the set of upstream hosts change, a connection will likely be sent to the same upstream as it was before. Increasing the table size reduces the amount of disruption. The table size must be prime number limited to 5000011. If it is not specified, the default is 65537.
          - `random` object: Random selects a random available host. The random load balancer generally performs better than round-robin if no health checking policy is configured. Random selection avoids bias towards the host in the set that comes after a failed host.
          - `ringHash` object: RingHash implements consistent hashing to upstream hosts. Each host is mapped onto a circle (the “ring”) by hashing its address; each request is then routed to a host by hashing some property of the request, and finding the nearest corresponding host clockwise around the ring.
            - `hashFunction` 'XXHash' | 'MurmurHash2': HashFunction is a function used to hash hosts onto the ketama ring. The value defaults to XX_HASH. Available values – XX_HASH, MURMUR_HASH_2.
            - `hashPolicies` object[]: HashPolicies specify a list of request/connection properties that are used to calculate a hash. These hash policies are executed in the specified order. If a hash policy has the “terminal” attribute set to true, and there is already a hash generated, the hash is returned immediately, ignoring the rest of the hash policy list.
              - …
            - `maxRingSize` integer: Maximum hash ring size. Defaults to 8M entries, and limited to 8M entries, but can be lowered to further constrain resource use.
            - `minRingSize` integer: Minimum hash ring size. The larger the ring is (that is, the more hashes there are for each provided host) the better the request distribution will reflect the desired weights. Defaults to 1024 entries, and limited to 8M entries.
          - `roundRobin` object: RoundRobin is a load balancing algorithm that distributes requests across available upstream hosts in round-robin order.
          - `type` 'RoundRobin' | 'LeastRequest' | 'RingHash' | 'Random' | 'Maglev', required
        - `localityAwareness` object: LocalityAwareness contains configuration for locality aware load balancing.
          - `crossZone` object: CrossZone defines locality aware load balancing priorities when dataplane proxies inside local zone are unavailable
            - `failover` object[]: Failover defines list of load balancing rules in order of priority
              - …
            - `failoverThreshold` object: FailoverThreshold defines the percentage of live destination dataplane proxies below which load balancing to the next priority starts. Example: If you configure failoverThreshold to 70, and you have deployed 10 destination dataplane proxies. Load balancing to next priority will start when number of live destination dataplane proxies drops below 7. Default 50
              - …
          - `disabled` boolean: Disabled allows to disable locality-aware load balancing. When disabled requests are distributed across all endpoints regardless of locality.
          - `localZone` object: LocalZone defines locality aware load balancing priorities between dataplane proxies inside a zone
            - `affinityTags` object[]: AffinityTags list of tags for local zone load balancing.
              - …
      - `targetRef` object, required: TargetRef is a reference to the resource that represents a group of destinations.
        - `kind` 'Mesh' | 'MeshSubset' | 'MeshGateway' | 'MeshService' | 'MeshExternalService' | 'MeshMultiZoneService' | 'MeshServiceSubset' | 'MeshHTTPRoute' | 'Dataplane', required: Kind of the referenced resource
        - `labels` object: Labels are used to select group of MeshServices that match labels. Either Labels or Name and Namespace can be used.
        - `mesh` string: Mesh is reserved for future use to identify cross mesh resources.
        - `name` string: Name of the referenced resource. Can only be used with kinds: `MeshService`, `MeshServiceSubset` and `MeshGatewayRoute`
        - `namespace` string: Namespace specifies the namespace of target resource. If empty only resources in policy namespace will be targeted.
        - `proxyTypes` string[]: ProxyTypes specifies the data plane types that are subject to the policy. When not specified, all data plane types are targeted by the policy.
        - `sectionName` string: SectionName is used to target specific section of resource. For example, you can target port from MeshService.ports[] by its name. Only traffic to this port will be affected.
        - `tags` object: Tags used to select a subset of proxies by tags. Can only be used with kinds `MeshSubset` and `MeshServiceSubset`
  - `creationTime` string, date-time: Time at which the resource was created
  - `modificationTime` string, date-time: Time at which the resource was updated

## Response `200`

Successful response

- object
  - `warnings` string[]: warnings is a list of warning messages to return to the requesting Kuma API clients. Warning messages describe a problem the client making the API request should correct or be aware of.

## Other responses

- `201`: Successful response

## Changes

- **2025-10-02** `ecce2daf9de6`: 1 info
  - added the new optional request property `spec/to/items/default/hashPolicies`
- **2025-08-12** `b2800570b3e2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/konnect-api-beta/changes/v1/mesh/control-planes/:cpId/api/meshes/:mesh/meshloadbalancingstrategies/:name/put.md)

---

[API](https://skmtc.dev/kong/apis/konnect-api-beta.md) - [All operations](https://skmtc.dev/kong/apis/konnect-api-beta/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/konnect-api-beta/revisions/cef0f947e9c9?raw)
