io.ino.solrs

FastestServerLB

Related Docs: object FastestServerLB | package solrs

class FastestServerLB extends LoadBalancer with FastestServerLBJmxSupport

LB strategy that selects the fastest server based on the latest average response time. It's aimed to handle a multi datacenter setup where some server regularly need longer to response. It shall also detect short (subsecond) pauses of a server e.g. due to garbage collection or s.th. else.

The latest average response time is determined in the following order (the first found measure is used): - currently still running requests (if they're lasting longer than previous, already completed requests) - average response time of the current or the last second - average response time of the last ten seconds - total average resonse time

The response time is measured using the given testQuery. A dedicated test query is used, because queries can have very different performance characteristics, so that it might even be hard for an application to classify this. With the testQuery you have control what is used to measure response time.

For "normal" / "fast" servers (default: with a resonse time <= the average of all servers, you can override determineFastServers) test queries are run whenever a request comes in, but between test queries at least the minDelay has to be passed. This way servers are not hammered with requests when nobody else is using your search, but if there's high traffic this load balancer get high resolution of monitoring data to detect short pauses as well.

For "slow" servers (default: response time > average) tests are run using the specified maxDelay.

Directly after creation of this LoadBalancer / AsnycSolrClient multiple test queries are run (according to the specified initialTestRuns, by default 10) to have initial stats.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. FastestServerLB
  2. FastestServerLBJmxSupport
  3. FastestServerLBMBean
  4. LoadBalancer
  5. RequestInterceptor
  6. AnyRef
  7. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new FastestServerLB(solrServers: SolrServers, collectionAndTestQuery: (SolrServer) ⇒ (String, SolrQuery), minDelay: Duration = 100 millis, maxDelay: Duration = 10 seconds, initialTestRuns: Int = 10, filterFastServers: (Long) ⇒ ((SolrServer, Long)) ⇒ Boolean = ..., clock: Clock = Clock.systemDefault)

    solrServers

    solr servers to load balance, those are regularly tested.

    collectionAndTestQuery

    a function that returns the collection name and a testQuery for the given server. The collection is used to partition server when classifying "fast"/"slow" servers, because for different collections response times will be different. It's somehow similar with the testQuery: it might be different per server, e.g. some server might only provide a /suggest handler while others provide /select (which can be specified via the "qt" query param in the test query).

    minDelay

    the minimum delay between the response of a test and the start of the next test (to limit test frequency)

    maxDelay

    the delay between tests for slow servers (or all servers if there are no real requests)

    initialTestRuns

    on start each active server is tested the given number of times to gather initial stats and determine fast/slow servers.

    filterFastServers

    a function to filter fast / preferred servers. The function takes the calculated average duration of all servers of a collection, and returns a function for a SolrServer->Duration tuple that returns true/false to indicate if a server should be considered "fast". The default value for filterFastServers uses duration <= average * 1.1 + 5 (use 1.1 as multiplier to accepted some deviation, for smaller values like 1 or 2 millis also add some fix value to allow normal deviation).

    clock

    the clock to get the current time from. The tests using the maxDelay are run using a scheduled executor, therefore this interval uses the system clock

Value Members

  1. final def !=(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def averagesPer10Seconds(collection: String): TabularData

  6. def averagesPerSecond(collection: String): TabularData

  7. def averagesTotalAverage(collection: String): CompositeData

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. val collectionAndTestQuery: (SolrServer) ⇒ (String, SolrQuery)

    a function that returns the collection name and a testQuery for the given server.

    a function that returns the collection name and a testQuery for the given server. The collection is used to partition server when classifying "fast"/"slow" servers, because for different collections response times will be different. It's somehow similar with the testQuery: it might be different per server, e.g. some server might only provide a /suggest handler while others provide /select (which can be specified via the "qt" query param in the test query).

  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def fastServers(collection: String): CompositeData

  13. var fastServersByCollection: Map[String, Set[SolrServer]]

    Attributes
    protected
  14. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  15. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  16. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  17. def init(): Unit

    Attributes
    protected
  18. def initJmx(): Unit

    Definition Classes
    FastestServerLBJmxSupport
  19. def interceptQuery(f: (SolrServer, SolrQuery) ⇒ Future[QueryResponse])(solrServer: SolrServer, q: SolrQuery): Future[QueryResponse]

    Intercept user queries to trigger test queries based on the current request rate.

    Intercept user queries to trigger test queries based on the current request rate.

    f

    the function to intercept

    solrServer

    the SolrServer that's used to run the query

    q

    the query to send to solr.

    returns

    the query response.

    Definition Classes
    FastestServerLBLoadBalancerRequestInterceptor
  20. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  21. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  22. final def notify(): Unit

    Definition Classes
    AnyRef
  23. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  24. def onBeforeFastServersChanged(collection: String, fastServers: Set[SolrServer], durationByServer: Map[SolrServer, Long], average: Long): Unit

    Attributes
    protected
  25. def predictDurations(collection: String): CompositeData

  26. def scheduleTests(): Unit

    Attributes
    protected
  27. def scheduleUpdateStats(): Unit

    Attributes
    protected
  28. val serverTestTimestamp: Map[SolrServer, Millisecond]

    Attributes
    protected[io.ino.solrs]
  29. def setAsyncSolrClient(client: AsyncSolrClient): Unit

    On creation of AsyncSolrClient this method is invoked with the created instance.

    On creation of AsyncSolrClient this method is invoked with the created instance. Subclasses can override this method to get access to the solr client.

    Definition Classes
    FastestServerLBLoadBalancer
  30. def shutdown(): Unit

    Definition Classes
    FastestServerLBLoadBalancer
  31. def shutdownJmx(): Unit

    Definition Classes
    FastestServerLBJmxSupport
  32. def solrServer(q: SolrQuery): Option[SolrServer]

    Determines the solr server to use for a new request.

    Determines the solr server to use for a new request.

    Definition Classes
    FastestServerLBLoadBalancer
  33. val solrServers: SolrServers

    solr servers to load balance, those are regularly tested.

    solr servers to load balance, those are regularly tested.

    Definition Classes
    FastestServerLBLoadBalancer
  34. def stats(server: SolrServer): PerformanceStats

    Attributes
    protected
  35. val statsByServer: TrieMap[SolrServer, PerformanceStats]

    Attributes
    protected[io.ino.solrs]
  36. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  37. def toString(): String

    Definition Classes
    AnyRef → Any
  38. def updateFastServers(): Unit

    Determines the servers that are tested more frequently.

    Determines the servers that are tested more frequently.

    Attributes
    protected
  39. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from FastestServerLBJmxSupport

Inherited from FastestServerLBMBean

Inherited from LoadBalancer

Inherited from RequestInterceptor

Inherited from AnyRef

Inherited from Any

Ungrouped