平衡查询负载
本主题介绍了如何在 Milvus 中平衡查询负载。
Milvus 默认支持自动负载均衡。你可以 配置 你的 Milvus 以启用或禁用 自动负载均衡。通过指定 queryCoord.balanceIntervalSeconds
,queryCoord.overloadedMemoryThresholdPercentage
和 queryCoord.memoryUsageMaxDifferencePercentage
,你可以更改触发自动负载均衡的阈值。
如果禁用了自动负载均衡,你仍然可以通过手动方式平衡负载。
检查分段信息
获取你预期要传输的密封段的 segmentID
,以及你预期将段传输到的查询节点的 nodeID
。
{{fragments/multiple_code.md}}
from pymilvus import utility
utility.get_query_segment_info("book")
// This function is under active development on the GO client.
milvusClient.getQuerySegmentInfo(
GetQuerySegmentInfoParam.newBuilder()
.withCollectionName("book")
.build()
);
await getQuerySegmentInfo({
collectionName: "book",
});
show query_segment -c book
Python 示例:
JavaScript 示例:
Java 示例:
Shell 示例:
传输段
Transfer the sealed segment(s) with the segmentID
and the nodeID
of the current query node and new query node(s).
{{fragments/multiple_code.md}}
utility.load_balance(
src_node_id=3,
dst_node_ids=[4],
sealed_segment_ids=[431067441441538050]
)
// This function is under active development on the GO client.
milvusClient.loadBalance(
LoadBalanceParam.newBuilder()
.withSourceNodeID(3L)
.addDestinationNodeID(4L)
.addSegmentID(431067441441538050L)
.build()
);
await loadBalance({
src_nodeID: 3,
dst_nodeIDs: [4],
sealed_segmentIDs: [431067441441538050]
});
load_balance -s 3 -d 4 -ss 431067441441538050