Hystrix in Go

·

1 min read

What is hystrix

The hytrix settings

type CommandConfig struct {
    Timeout                int    `json:"timeout"`
    CommandGroup           string `json:"command_group"`
    MaxConcurrentRequests  int    `json:"max_concurrent_requests"`
    RequestVolumeThreshold int    `json:"request_volume_threshold"`
    SleepWindow            int    `json:"sleep_window"`
    ErrorPercentThreshold  int    `json:"error_percent_threshold"`
    QueueSizeRejectionThreshold int `json:"queue_size_rejection_threshold"`
}
  • Timeout: how long to wait for the command to complete.
  • MaxConcurrentRequests: how many commands of the same type can run at the same time.
  • RequestVolumeThreshold: the minimun requests that needed before a circuit can be tripped due to health.
  • SleepWindow: how long to wait in milliseconds, to wait after a circuit opens before testing for recovery.
  • ErrorPercentThreshold: causes the circuit opens once the rolling measure off errors exceeds this percent of requests.
  • QueueSizeRejectionThreshold: reject the requests when the queue size exceeds the given limit.

An hystrix example