Interface AdaptiveServerSelector

  • All Known Implementing Classes:
    HybridSelector, LatencySelector, NumInFlightReqSelector

    public interface AdaptiveServerSelector
    The AdaptiveServerSelector intelligently selects the best available server for a segment during query processing. The decision is made based on stats recorded for each server during query processing.
    • Method Detail

      • select

        String select​(List<String> serverCandidates)
        Picks the best server to route a query from the list of candidate servers.
        Parameters:
        serverCandidates - Candidate servers from which the best server should be chosen.
        Returns:
        server identifier
      • fetchAllServerRankingsWithScores

        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. 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.
        Returns:
        List of servers along with their values ranked from best to worst.
      • fetchServerRankingsWithScores

        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. 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.
        Returns:
        List of servers along with their values ranked from best to worst.