Package

com.twitter.finagle

loadbalancer

Permalink

package loadbalancer

This package implements client side load balancing algorithms.

As an end-user, see the Balancers API to create instances which can be used to configure a Finagle client with various load balancing strategies.

As an implementor, each algorithm gets its own subdirectory and is exposed via the Balancers object. Several convenient traits are provided which factor out common behavior and can be mixed in (i.e. Balancer, DistributorT, NodeT, and Updating).

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. loadbalancer
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. final class BalancerRegistry extends AnyRef

    Permalink

    A registry of load balancers currently in use.

    A registry of load balancers currently in use.

    This class is thread-safe.

    See also

    TwitterServer's "/admin/balancers.json" admin endpoint.

    BalancerRegistry$.get()

  2. trait EndpointFactory[Req, Rep] extends ServiceFactory[Req, Rep]

    Permalink

    A specialized ServiceFactory which admits that it backs a concrete endpoint.

    A specialized ServiceFactory which admits that it backs a concrete endpoint. The extra information and functionality provided here is used by Finagle's load balancers.

  3. abstract class LoadBalancerFactory extends AnyRef

    Permalink

    A thin interface around a Balancer's constructor that allows Finagle to pass in context from the stack to the balancers at construction time.

    A thin interface around a Balancer's constructor that allows Finagle to pass in context from the stack to the balancers at construction time.

    See also

    The user guide for more details.

    Balancers for a collection of available balancers.

  4. final class Metadata extends AnyRef

    Permalink

    Information about a load balancer.

    Information about a load balancer.

    This class is thread-safe and while the class itself is immutable, it proxies data from a Balancer which may be mutable.

    See also

    TwitterServer's "/admin/balancers.json" admin endpoint.

    BalancerRegistry

  5. class NoNodesOpenException extends RuntimeException with FailureFlags[NoNodesOpenException] with HasLogLevel with SourcedException

    Permalink

    While this exception is safe to retry, the assumption used here is that the underlying situation will not change soon enough to make a retry worthwhile as retrying is most likely to eat up the entire budget.

  6. sealed trait WhenNoNodesOpen extends AnyRef

    Permalink

    The behavior the load balancer should take when none of its nodes have a com.twitter.finagle.Status of Open.

    The behavior the load balancer should take when none of its nodes have a com.twitter.finagle.Status of Open.

    The default behavior is WhenNoNodesOpen.PickOne and can be customized on a client through LoadBalancerFactory.WhenNoNodesOpenParam:

    import com.twitter.finagle.loadbalancer.LoadBalancerFactory.WhenNoNodesOpenParam
    import com.twitter.finagle.loadbalancer.WhenNoNodesOpen
    import com.twitter.finagle.Http
    
    Http.client
      .configured(WhenNoNodesOpenParam(WhenNoNodesOpen.FailFast))
    See also

    WhenNoNodesOpens for Java friendly API.

    the user guide.

  7. final class WhenNoNodesOpens extends AnyRef

    Permalink

Value Members

  1. object BalancerRegistry

    Permalink
  2. object Balancers

    Permalink

    Constructor methods for various load balancers.

    Constructor methods for various load balancers. The methods take balancer specific parameters and return a LoadBalancerFactory that allows you to easily inject a balancer into the Finagle client stack via the withLoadBalancer method.

    Example:
    1. configuring a client with a load balancer

      $Protocol.client
        .withLoadBalancer(Balancers.aperture())
        .newClient(...)
    See also

    The user guide for more details.

  3. object FlagBalancerFactory extends LoadBalancerFactory

    Permalink

    A LoadBalancerFactory proxy which instantiates the underlying based on flags (see flags.scala for applicable flags).

  4. object LoadBalancerFactory

    Permalink

    Exposes a Stack.Module which composes load balancing into the respective Stack.

    Exposes a Stack.Module which composes load balancing into the respective Stack. This is mixed in by default into Finagle's com.twitter.finagle.client.StackClient. The only necessary configuration is a LoadBalancerFactory.Dest which represents a changing collection of addresses that is load balanced over.

  5. object WhenNoNodesOpen

    Permalink
  6. package aperture

    Permalink
  7. def defaultAddressOrdering: Ordering[Address]

    Permalink

    Returns the default process global Address ordering as set via defaultAddressOrdering.

    Returns the default process global Address ordering as set via defaultAddressOrdering. If no value is set, Address.HashOrdering is used with the assumption that hosts resolved via Finagle provide the load balancer with resolved InetAddresses. If a separate resolution process is used, outside of Finagle, the default ordering should be overridden.

  8. def defaultAddressOrdering(order: Ordering[Address]): Unit

    Permalink

    Set the default Address ordering for the entire process (outside of clients which override it).

    Set the default Address ordering for the entire process (outside of clients which override it).

    See also

    LoadBalancerFactory.AddressOrdering for more info.

  9. object defaultBalancer extends GlobalFlag[String]

    Permalink

    A GlobalFlag that changes the default balancer for every client in the process.

    A GlobalFlag that changes the default balancer for every client in the process. Valid choices are ['heap', 'choice', and 'aperture'].

    To configure the load balancer on a per-client granularity instead, use the withLoadBalancer method like so:

    {{ val balancer = Balancers.aperture(...) $Protocol.client.withLoadBalancer(balancer) }}

  10. def defaultBalancerFactory: LoadBalancerFactory

    Permalink

    Returns the default process global LoadBalancerFactory as set via defaultBalancerFactory.

  11. def defaultBalancerFactory(factory: LoadBalancerFactory): Unit

    Permalink

    Set the default LoadBalancerFactory for the entire process (outside of clients which override it).

    Set the default LoadBalancerFactory for the entire process (outside of clients which override it).

    See also

    LoadBalancerFactory.Param for more info.

  12. package exp

    Permalink
  13. object perHostStats extends GlobalFlag[Boolean]

    Permalink

    A GlobalFlag which allows the configuration of per host (or endpoint) stats to be toggled.

    A GlobalFlag which allows the configuration of per host (or endpoint) stats to be toggled. Note, these are off by default because they tend to be expensive, especially when the size of the destination cluster is large. However, they can be quite useful for debugging.

Inherited from AnyRef

Inherited from Any

Ungrouped