AGENTS.md
src/core/load_balancing/AGENTS.mdAGENTS.md
Quality
48/100
Scores the file, not the repository.Length
575 words
6 headings · 0 code blocksRepository
45k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# gRPC Load Balancing23This directory contains the implementation of gRPC's load balancing framework.45See also: [gRPC Client Channel overview](../client_channel/AGENTS.md)67## Overarching Purpose89The code in this directory provides a flexible and extensible framework for load balancing. It allows different load balancing policies to be plugged in to gRPC to control how RPCs are distributed across a set of backend servers.1011## Core Concepts1213The load balancing framework is built around a few key abstractions:1415* **`LoadBalancingPolicy`**: The `LoadBalancingPolicy` is the main abstraction for load balancing in gRPC. It is responsible for creating and managing subchannels, and for deciding which subchannel to use for each RPC.16* **`SubchannelPicker`**: The `SubchannelPicker` is a simple interface that is used to select a subchannel for a given RPC. Each `LoadBalancingPolicy` has a `SubchannelPicker` that is used to make the final routing decision.17* **`LoadBalancingPolicyFactory`**: A `LoadBalancingPolicyFactory` is responsible for creating instances of a particular `LoadBalancingPolicy`.18* **`LoadBalancingPolicyRegistry`**: The `LoadBalancingPolicyRegistry` is a global registry of `LoadBalancingPolicyFactory` instances. This registry is used to create `LoadBalancingPolicy` instances by name.1920## Load Balancing Policies2122gRPC comes with a number of built-in load balancing policies, each of which is implemented in its own subdirectory:2324* **`pick_first`**: This policy tries to connect to the first address in the list, and if that fails, it tries the next one, and so on. It's the default policy if no other is specified.25* **`round_robin`**: This policy distributes RPCs across all available backend connections in a round-robin fashion.26* **`weighted_round_robin`**: A more advanced version of round-robin that takes into account the weights of the different backends.27* **`ring_hash`**: This policy uses a consistent hashing algorithm to distribute RPCs across the backends. This is useful for session affinity, as it ensures that all RPCs for a given session are sent to the same backend.28* **`grpclb`**: This policy uses an external load balancer to make load balancing decisions. The external load balancer is typically a separate process that is running on the same machine as the gRPC client.29* **`xds`**: This policy uses the xDS protocol to configure load balancing. xDS is a set of APIs that are used to configure service discovery, load balancing, and other features in a service mesh. See the [xDS documentation](../xds/AGENTS.md) for more details.30* **`rls`**: Route Lookup Service. This policy uses a separate service to determine the route for each RPC.3132## Files3334* **`lb_policy.h`, `lb_policy.cc`**: These files define the core `LoadBalancingPolicy` interface.35* **`lb_policy_registry.h`, `lb_policy_registry.cc`**: These files define the `LoadBalancingPolicyRegistry`.36* **`subchannel_interface.h`**: Defines the interface that a subchannel must implement to be used by a `LoadBalancingPolicy`.37* **`child_policy_handler.h`, `child_policy_handler.cc`**: A helper class for implementing composite load balancing policies that delegate to child policies. This is used by policies like `xds` and `priority`.38* **`address_filtering.h`, `address_filtering.cc`**: A helper class for filtering addresses based on a set of attributes. This is used by policies like `xds` to implement locality-based routing.39* **`health_check_client.h`, `health_check_client.cc`**: A client for the gRPC health checking protocol. This is used by some LB policies to determine the health of the backends.4041## Notes4243* gRPC's load balancing framework is highly extensible. New load balancing policies can be added by implementing the `LoadBalancingPolicy` and `LoadBalancingPolicyFactory` interfaces and registering the factory with the `LoadBalancingPolicyRegistry`.44* The load balancing policy is chosen based on the service config, which can be provided by the [resolver](../resolver/AGENTS.md).45* Load balancing is primarily used in the client channel. See the [client channel documentation](../client_channel/AGENTS.md) for more details.46
Also in grpc/grpc
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| grpc/grpcsrc/core/ext/filters/census/AGENTS.md · 45k | AGENTS.md | no sections | 25/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/gcp_authentication/AGENTS.md · 45k | AGENTS.md | security | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/http/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/stateful_session/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/chaotic_good/AGENTS.md · 45k | AGENTS.md | no sections | 48/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/inproc/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/filter/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/handshaker/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/server/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/service_config/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/telemetry/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/transport/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/transport/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/filters/backend_metrics/AGENTS.md · 45k | AGENTS.md | no sections | 44/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/tsi/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/tsi/alts/AGENTS.md · 45k | AGENTS.md | no sections | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/credentials/call/AGENTS.md · 45k | AGENTS.md | security | 39/100 | 3 days ago | |
| grpc/grpcsrc/core/ext/transport/chttp2/AGENTS.md · 45k | AGENTS.md | testarchdependencies | 48/100 | 3 days ago | |
| grpc/grpcAGENTS.md · 45k | AGENTS.md | styledependenciesdo-not | 54/100 | 3 days ago |
Diff against src/core/ext/filters/census/AGENTS.md Diff against src/core/ext/filters/gcp_authentication/AGENTS.md Diff against src/core/ext/filters/http/AGENTS.md Diff against src/core/ext/filters/stateful_session/AGENTS.md Diff against src/core/ext/transport/chaotic_good/AGENTS.md Diff against src/core/ext/transport/inproc/AGENTS.md Diff against src/core/filter/AGENTS.md Diff against src/core/handshaker/AGENTS.md Diff against src/core/server/AGENTS.md Diff against src/core/service_config/AGENTS.md Diff against src/core/telemetry/AGENTS.md Diff against src/core/transport/AGENTS.md Diff against src/core/credentials/transport/AGENTS.md Diff against src/core/ext/filters/backend_metrics/AGENTS.md Diff against src/core/credentials/AGENTS.md Diff against src/core/tsi/AGENTS.md Diff against src/core/tsi/alts/AGENTS.md Diff against src/core/credentials/call/AGENTS.md Diff against src/core/ext/transport/chttp2/AGENTS.md Diff against AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| vllm-project/vllmAGENTS.md · 88k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| react/react-nativepackages/react-native-compatibility-check/AGENTS.md · 126k | AGENTS.md | testlint-formatstylearch+4 | 99/100 | 3 days ago | |
| netdata/netdatasrc/go/plugin/ibm.d/AGENTS.md · 80k | AGENTS.md | buildtestlint-formatarch+3 | 99/100 | 3 days ago | |
| dragonflydb/dragonflyAGENTS.md · 31k | AGENTS.md | setupbuildtestlint-format+10 | 96/100 | 2 days ago | |
| dotnet/aspnetcoresrc/Components/AGENTS.md · 38k | AGENTS.md | buildteststylearch+3 | 96/100 | 3 days ago | |
| duckdb/duckdbAGENTS.md · 40k | AGENTS.md | buildtestlint-formatstyle+8 | 96/100 | today | |
| steipete/CodexBarAGENTS.md · 20k | AGENTS.md | buildteststylearch+4 | 93/100 | 3 days ago |
