Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrLimit = "Hertz Adaptive Limit"
)
Functions ¶
func AdaptiveLimit ¶
func AdaptiveLimit(opts ...Option) app.HandlerFunc
AdaptiveLimit CPU sampling algorithm using BBR
Types ¶
type BBR ¶
type BBR struct {
// contains filtered or unexported fields
}
BBR implements bbr-like limiter.It is inspired by sentinel. https://github.com/alibaba/Sentinel/wiki/%E7%B3%BB%E7%BB%9F%E8%87%AA%E9%80%82%E5%BA%94%E9%99%90%E6%B5%81
func NewLimiter ¶
type Option ¶
type Option func(o *options)
func WithBucket ¶
WithBucket defines bucket number for each window
func WithCPUThreshold ¶
WithCPUThreshold defines cpu threshold load. e.g. if you want to set the cpu threshold to 80%, you should set the value to 800.
func WithSamplingTime ¶
WithSamplingTime defines cpu sampling time interval
func WithWindow ¶
WithWindow defines time duration per window
Click to show internal directories.
Click to hide internal directories.