Packages

t

com.twitter.finagle.client

BaseMethodBuilder

trait BaseMethodBuilder[T] extends AnyRef

A base interface for protocol-specific MethodBuilder implementations. Acts as a template for MethodBuilder pattern and provides the documentation for common methods.

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

Abstract Value Members

  1. abstract def idempotent(maxExtraLoad: Tunable[Double]): T

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad to decrease tail latency by sending an additional fraction of requests.

    maxExtraLoad

    How much extra load, as a Tunable[Double], we are willing to send to the server. Must be between 0.0 and 1.0. Backup requests can be disabled by setting this to 0.0.

    See also

    The MethodBuilder section in the user guide for further details.

  2. abstract def idempotent(maxExtraLoad: Double): T

    Configure that requests are to be treated as idempotent.

    Configure that requests are to be treated as idempotent. Because requests can be safely retried, BackupRequestFilter is configured with the params maxExtraLoad to decrease tail latency by sending an additional fraction of requests.

    If you are using TwitterServer, a good starting point for determining a value for maxExtraLoad is looking at the details of the PDF histogram for request latency, at /admin/histograms. If you choose a maxExtraLoad of 1.percent, for example, you can expect your p999/p9999 latencies to (roughly) now be that of your p99 latency. For 5.percent, those latencies would shift to your p95 latency. You should also ensure that your backend can tolerate the increased load.

    maxExtraLoad

    How much extra load, as a fraction, we are willing to send to the server. Must be between 0.0 and 1.0. Backup requests can be disabled by setting this to 0.0.

    See also

    The MethodBuilder section in the user guide for further details.

  3. abstract def nonIdempotent: T

    Configure that requests are to be treated as non-idempotent.

    Configure that requests are to be treated as non-idempotent. BackupRequestFilter is disabled, and only those failures that are known to be safe to retry (i.e., write failures, where the request was never sent) are retried via requeue filter; any previously configured retries are removed.

    See also

    The MethodBuilder section in the user guide for further details.

  4. abstract def withRetryDisabled: T

    Disables "application" level retries.

    Disables "application" level retries.

    This does not disable retries of failures that are known to be safe to retry via com.twitter.finagle.service.RequeueFilter.

    This causes the logical success metrics to be based on the default response classifier rules of a Return response is a success, while everything else is not.

    Example:
    1. import com.twitter.finagle.http.Http
      
      val client: Http.Client = ???
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withRetryDisabled
    See also

    withRetryForClassifier

    The MethodBuilder section in the user guide for further details.

  5. abstract def withRetryForClassifier(classifier: ResponseClassifier): T

    Retry based on ResponseClassifier.

    Retry based on ResponseClassifier.

    The default behavior is to use the client's classifier which is typically configured through theClient.withResponseClassifier or ClientBuilder.withResponseClassifier.

    This classifier is used to determine which requests are unsuccessful. This is the basis for measuring the logical success metrics as well as logging unsuccessful requests at debug level.

    classifier

    when a Failed with retryable is true is returned for a given ReqRep, the request will be retried. This is often a ResponseClass.RetryableFailure.

    Example:
    1. For example, retrying on a 418 status code:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.http.Http
      import com.twitter.finagle.service.{ReqRep, ResponseClass}
      import com.twitter.util.Return
      
      val client: Http.Client = ???
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withRetryForClassifier {
        case ReqRep(_, Return(rep)) if rep.statusCode == 418 => ResponseClass.RetryableFailure
      }

      The classifier is also used to determine the logical success metrics of the client.

    See also

    withRetryDisabled

    response classification user guide

    The MethodBuilder section in the user guide for further details.

  6. abstract def withTimeoutPerRequest(howLong: Tunable[Duration]): T

    How long a single request is given to complete.

    How long a single request is given to complete.

    If there are retries, each attempt is given up to this amount of time.

    If a request does not complete within this time, the response will be satisfied with a com.twitter.finagle.IndividualRequestTimeoutException.

    Defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.Param(timeout), which is typically set via com.twitter.finagle.param.CommonParams.withRequestTimeout.

    howLong

    how long, from the initial request issuance, an individual attempt given to complete. If it is not finite (e.g. Duration.Top), no method specific timeout will be applied.

    returns

    a new instance with all other settings copied

    Example:
    1. For example, a per-request timeout of 50 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.http.Http
      import com.twitter.util.Duration
      import com.twitter.util.tunable.Tunable
      
      val client: Http.Client = ???
      val tunableTimeout: Tunable[Duration] = Tunable.const("id", 50.milliseconds)
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withTimeoutPerRequest(tunableTimeout))
    See also

    withTimeoutTotal(Tunable[Duration])

    The MethodBuilder section in the user guide for further details.

  7. abstract def withTimeoutPerRequest(howLong: Duration): T

    How long a single request is given to complete.

    How long a single request is given to complete.

    If there are retries, each attempt is given up to this amount of time.

    If a request does not complete within this time, the response will be satisfied with a com.twitter.finagle.IndividualRequestTimeoutException.

    Defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.Param(timeout), which is typically set via com.twitter.finagle.param.CommonParams.withRequestTimeout.

    howLong

    how long, from the initial request issuance, an individual attempt given to complete. If it is not finite (e.g. Duration.Top), no method specific timeout will be applied.

    returns

    a new instance with all other settings copied

    Example:
    1. For example, a per-request timeout of 50 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.http.Http
      import com.twitter.util.Duration
      
      val client: Http.Client = ???
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withTimeoutPerRequest(50.milliseconds))
    See also

    withTimeoutTotal(Duration)

    The MethodBuilder section in the user guide for further details.

  8. abstract def withTimeoutTotal(howLong: Tunable[Duration]): T

    Set a total timeout with a Tunable, including time spent on retries.

    Set a total timeout with a Tunable, including time spent on retries.

    If the request does not complete in this time, the response will be satisfied with a com.twitter.finagle.GlobalRequestTimeoutException.

    Defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.TotalTimeout(timeout).

    howLong

    how long, from the initial request issuance, is the request given to complete. If it is not finite (e.g. Duration.Top), no method specific timeout will be applied.

    returns

    a new instance with all other settings copied

    Example:
    1. For example, a total timeout of 200 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.http.Http
      import com.twitter.util.Duration
      import com.twitter.util.tunable.Tunable
      
      val client: Http.Client = ???
      val tunableTimeout: Tunable[Duration] = Tunable.const("id", 200.milliseconds)
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withTimeoutTotal(tunableTimeout))
    See also

    withTimeoutPerRequest(Tunable[Duration])

    The MethodBuilder section in the user guide for further details.

  9. abstract def withTimeoutTotal(howLong: Duration): T

    Set a total timeout, including time spent on retries.

    Set a total timeout, including time spent on retries.

    If the request does not complete in this time, the response will be satisfied with a com.twitter.finagle.GlobalRequestTimeoutException.

    Defaults to using the client's configuration for com.twitter.finagle.service.TimeoutFilter.TotalTimeout(timeout).

    howLong

    how long, from the initial request issuance, is the request given to complete. If it is not finite (e.g. Duration.Top), no method specific timeout will be applied.

    returns

    a new instance with all other settings copied

    Example:
    1. For example, a total timeout of 200 milliseconds:

      import com.twitter.conversions.DurationOps._
      import com.twitter.finagle.http.Http
      import com.twitter.util.Duration
      
      val client: Http.Client = ???
      val builder = client.methodBuilder("inet!example.com:80")
      builder.withTimeoutTotal(200.milliseconds))
    See also

    withTimeoutPerRequest(Duration)

    The MethodBuilder section in the user guide for further details.

Concrete 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 clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped