milvus-logo

Balance Query Load

This topic describes how to balance query load in Milvus.

Milvus supports automatic load balance by default. You can configure your Milvus to enable or disable automatic load balance. By specifying queryCoord.balanceIntervalSeconds, queryCoord.overloadedMemoryThresholdPercentage, and queryCoord.memoryUsageMaxDifferencePercentage, you can change the thresholds that trigger the automatic load balance.

If automatic load balance is disabled, you can still balance the load manually.

Check segment information

Get the segmentID of the sealed segment that you expect to transfer and the nodeID of the query node that you expect to transfer the segment to.

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
Parameter Description
collection_name Name of the collection to check the segment information.
Parameter Description
collectionName Name of the collection to check the segment information.
Parameter Description
CollectionName Name of the collection to check the segment information.
Option Description
-c Name of the collection to check the segment information.

Transfer segment

Transfer the sealed segment(s) with the segmentID and the nodeID of the current query node and new query node(s).

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
Parameter Description
src_node_id ID of the query node you want to transfer segment(s) from.
dst_node_ids (Optional) ID(s) of the query node(s) you want to transfer segment(s) to. Milvus transfers segment(s) to other query nodes automatically if this parameter is left blank.
sealed_segment_ids (Optional) ID(s) of the segment(s) you want to transfer. Milvus transfers all sealed segment(s) in the source query node to other query nodes automatically if this parameter is left blank.
Parameter Description
src_nodeID ID of the query node you want to transfer segment(s) from.
dst_nodeIDs (Optional) ID(s) of the query node(s) you want to transfer segment(s) to. Milvus transfers segment(s) to other query nodes automatically if this parameter is left blank.
sealed_segmentIDs (Optional) ID(s) of the segment(s) you want to transfer. Milvus transfers all sealed segment(s) in the source query node to other query nodes automatically if this parameter is left blank.
Parameter Description
SourceNodeID ID of the query node you want to transfer segment(s) from.
DestinationNodeID (Optional) ID(s) of the query node(s) you want to transfer segment(s) to. Milvus transfers segment(s) to other query nodes automatically if this parameter is left blank.
SegmentID (Optional) ID(s) of the segment(s) you want to transfer. Milvus transfers all sealed segment(s) in the source query node to other query nodes automatically if this parameter is left blank.
Option Description
-s ID of the query node you want to transfer segment(s) from.
-d (Multiple) ID(s) of the query node(s) you want to transfer segment(s) to.
-ss (Multiple) ID(s) of the segment(s) you want to transfer.

What's next

On this page