Class ServiceConfig.RetryThrottlingPolicy

  • All Implemented Interfaces:
    com.google.protobuf.Message, com.google.protobuf.MessageLite, com.google.protobuf.MessageLiteOrBuilder, com.google.protobuf.MessageOrBuilder, ServiceConfig.RetryThrottlingPolicyOrBuilder, Serializable
    Enclosing class:
    ServiceConfig

    public static final class ServiceConfig.RetryThrottlingPolicy
    extends com.google.protobuf.GeneratedMessageV3
    implements ServiceConfig.RetryThrottlingPolicyOrBuilder
     If a RetryThrottlingPolicy is provided, gRPC will automatically throttle
     retry attempts and hedged RPCs when the client's ratio of failures to
     successes exceeds a threshold.
     For each server name, the gRPC client will maintain a token_count which is
     initially set to max_tokens. Every outgoing RPC (regardless of service or
     method invoked) will change token_count as follows:
       - Every failed RPC will decrement the token_count by 1.
       - Every successful RPC will increment the token_count by token_ratio.
     If token_count is less than or equal to max_tokens / 2, then RPCs will not
     be retried and hedged RPCs will not be sent.
     
    Protobuf type grpc.service_config.ServiceConfig.RetryThrottlingPolicy
    See Also:
    Serialized Form
    • Field Detail

      • MAX_TOKENS_FIELD_NUMBER

        public static final int MAX_TOKENS_FIELD_NUMBER
        See Also:
        Constant Field Values
      • TOKEN_RATIO_FIELD_NUMBER

        public static final int TOKEN_RATIO_FIELD_NUMBER
        See Also:
        Constant Field Values
    • Method Detail

      • newInstance

        protected Object newInstance​(com.google.protobuf.GeneratedMessageV3.UnusedPrivateParameter unused)
        Overrides:
        newInstance in class com.google.protobuf.GeneratedMessageV3
      • getUnknownFields

        public final com.google.protobuf.UnknownFieldSet getUnknownFields()
        Specified by:
        getUnknownFields in interface com.google.protobuf.MessageOrBuilder
        Overrides:
        getUnknownFields in class com.google.protobuf.GeneratedMessageV3
      • getDescriptor

        public static final com.google.protobuf.Descriptors.Descriptor getDescriptor()
      • internalGetFieldAccessorTable

        protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()
        Specified by:
        internalGetFieldAccessorTable in class com.google.protobuf.GeneratedMessageV3
      • getMaxTokens

        public int getMaxTokens()
         The number of tokens starts at max_tokens. The token_count will always be
         between 0 and max_tokens.
         This field is required and must be greater than zero.
         
        uint32 max_tokens = 1;
        Specified by:
        getMaxTokens in interface ServiceConfig.RetryThrottlingPolicyOrBuilder
        Returns:
        The maxTokens.
      • getTokenRatio

        public float getTokenRatio()
         The amount of tokens to add on each successful RPC. Typically this will
         be some number between 0 and 1, e.g., 0.1.
         This field is required and must be greater than zero. Up to 3 decimal
         places are supported.
         
        float token_ratio = 2;
        Specified by:
        getTokenRatio in interface ServiceConfig.RetryThrottlingPolicyOrBuilder
        Returns:
        The tokenRatio.
      • isInitialized

        public final boolean isInitialized()
        Specified by:
        isInitialized in interface com.google.protobuf.MessageLiteOrBuilder
        Overrides:
        isInitialized in class com.google.protobuf.GeneratedMessageV3
      • writeTo

        public void writeTo​(com.google.protobuf.CodedOutputStream output)
                     throws IOException
        Specified by:
        writeTo in interface com.google.protobuf.MessageLite
        Overrides:
        writeTo in class com.google.protobuf.GeneratedMessageV3
        Throws:
        IOException
      • getSerializedSize

        public int getSerializedSize()
        Specified by:
        getSerializedSize in interface com.google.protobuf.MessageLite
        Overrides:
        getSerializedSize in class com.google.protobuf.GeneratedMessageV3
      • equals

        public boolean equals​(Object obj)
        Specified by:
        equals in interface com.google.protobuf.Message
        Overrides:
        equals in class com.google.protobuf.AbstractMessage
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface com.google.protobuf.Message
        Overrides:
        hashCode in class com.google.protobuf.AbstractMessage
      • parseFrom

        public static ServiceConfig.RetryThrottlingPolicy parseFrom​(ByteBuffer data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static ServiceConfig.RetryThrottlingPolicy parseFrom​(com.google.protobuf.ByteString data)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static ServiceConfig.RetryThrottlingPolicy parseFrom​(com.google.protobuf.ByteString data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static ServiceConfig.RetryThrottlingPolicy parseFrom​(byte[] data)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • parseFrom

        public static ServiceConfig.RetryThrottlingPolicy parseFrom​(byte[] data,
                                                                    com.google.protobuf.ExtensionRegistryLite extensionRegistry)
                                                             throws com.google.protobuf.InvalidProtocolBufferException
        Throws:
        com.google.protobuf.InvalidProtocolBufferException
      • newBuilderForType

        public ServiceConfig.RetryThrottlingPolicy.Builder newBuilderForType()
        Specified by:
        newBuilderForType in interface com.google.protobuf.Message
        Specified by:
        newBuilderForType in interface com.google.protobuf.MessageLite
      • newBuilderForType

        protected ServiceConfig.RetryThrottlingPolicy.Builder newBuilderForType​(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)
        Specified by:
        newBuilderForType in class com.google.protobuf.GeneratedMessageV3
      • getParserForType

        public com.google.protobuf.Parser<ServiceConfig.RetryThrottlingPolicy> getParserForType()
        Specified by:
        getParserForType in interface com.google.protobuf.Message
        Specified by:
        getParserForType in interface com.google.protobuf.MessageLite
        Overrides:
        getParserForType in class com.google.protobuf.GeneratedMessageV3
      • getDefaultInstanceForType

        public ServiceConfig.RetryThrottlingPolicy getDefaultInstanceForType()
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageLiteOrBuilder
        Specified by:
        getDefaultInstanceForType in interface com.google.protobuf.MessageOrBuilder