Class NumInFlightReqSelector
- java.lang.Object
-
- org.apache.pinot.broker.routing.adaptiveserverselector.NumInFlightReqSelector
-
- All Implemented Interfaces:
AdaptiveServerSelector
public class NumInFlightReqSelector extends Object implements AdaptiveServerSelector
TheNumInFlightReqSelectoris an AdaptiveServerSelector implementation that picks the best server based on the number of in-flight queries being processed by the server. The server with the lowest number of in-flight queries is picked.
-
-
Constructor Summary
Constructors Constructor Description NumInFlightReqSelector(ServerRoutingStatsManager serverRoutingStatsManager)
-
Method Summary
Modifier and Type Method Description List<org.apache.commons.lang3.tuple.Pair<String,Double>>fetchAllServerRankingsWithScores()Returns the ranking of servers ordered from best to worst along with the absolute scores based on which the servers are ranked.List<org.apache.commons.lang3.tuple.Pair<String,Double>>fetchServerRankingsWithScores(List<String> serverCandidates)Same as above but fetches ranking only for the list of serverCandidates provided in the parameter.Stringselect(List<String> serverCandidates)Picks the best server to route a query from the list of candidate servers.
-
-
-
Constructor Detail
-
NumInFlightReqSelector
public NumInFlightReqSelector(ServerRoutingStatsManager serverRoutingStatsManager)
-
-
Method Detail
-
select
public String select(List<String> serverCandidates)
Description copied from interface:AdaptiveServerSelectorPicks the best server to route a query from the list of candidate servers.- Specified by:
selectin interfaceAdaptiveServerSelector- Parameters:
serverCandidates- Candidate servers from which the best server should be chosen.- Returns:
- server identifier
-
fetchAllServerRankingsWithScores
public List<org.apache.commons.lang3.tuple.Pair<String,Double>> fetchAllServerRankingsWithScores()
Description copied from interface:AdaptiveServerSelectorReturns the ranking of servers ordered from best to worst along with the absolute scores based on which the servers are ranked. Based on the implementation of the interface, the score could refer to different things. For NumInFlightReqSelector, score is the number of inflight requests. For LatencySelector, score is the EMA latency. For HybridSelector, score is the hybridScore which is computed by combining latency and # inflight requests.- Specified by:
fetchAllServerRankingsWithScoresin interfaceAdaptiveServerSelector- Returns:
- List of servers along with their values ranked from best to worst.
-
fetchServerRankingsWithScores
public List<org.apache.commons.lang3.tuple.Pair<String,Double>> fetchServerRankingsWithScores(List<String> serverCandidates)
Description copied from interface:AdaptiveServerSelectorSame as above but fetches ranking only for the list of serverCandidates provided in the parameter. If a server doesn't have an entry, it's ranked better than other serverCandidates and a value of -1.0 is returned. With the above "fetchAllServerRankingsWithScores" API, ranking for all the servers are fetched. This can become problematic if a broker is routing to multiple server tenants but a query needs to touch only a single server tenant. This API helps fetch ranking only for a subset of servers.- Specified by:
fetchServerRankingsWithScoresin interfaceAdaptiveServerSelector- Returns:
- List of servers along with their values ranked from best to worst.
-
-