Documentation ¶
Overview ¶
Package memlimiter - memory budget control subsystem for Go services. It tracks memory budget utilization and tries to stabilize memory usage with backpressure (GC and request throttling) techniques.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ControllerNextGC - NextGC-based controller ControllerNextGC *nextgc.ControllerConfig `json:"controller_nextgc"` //nolint:tagliatelle }
Config - high-level MemLimiter config.
type Option ¶ added in v0.0.2
type Option interface {
// contains filtered or unexported methods
}
Option - MemLimiter constructor options.
func WithBackpressureOperator ¶ added in v0.0.2
func WithBackpressureOperator(val backpressure.Operator) Option
WithBackpressureOperator allows client to provide customized backpressure.Operator; that's especially useful when implementing backpressure logic on the application side.
func WithServiceStatsSubscription ¶ added in v0.0.2
func WithServiceStatsSubscription(val stats.ServiceStatsSubscription) Option
WithServiceStatsSubscription allows client to provide own implementation of service stats subscription.
type Service ¶
type Service interface { Middleware() middleware.Middleware GetStats() (*stats.MemLimiterStats, error) // Quit terminates service gracefully. Quit() }
Service - a high-level interface for a memory usage control subsystem.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package backpressure contains code applying control signals issued by controller to Go runtime and and to gRPC server.
|
Package backpressure contains code applying control signals issued by controller to Go runtime and and to gRPC server. |
Package controller contains common types for different possible implementations of memory usage controller.
|
Package controller contains common types for different possible implementations of memory usage controller. |
nextgc
Package nextgc provides the implementation of memory usage controller, which aims to keep Go Runtime NextGC value lower than the RSS consumption hard limit to prevent OOM errors.
|
Package nextgc provides the implementation of memory usage controller, which aims to keep Go Runtime NextGC value lower than the RSS consumption hard limit to prevent OOM errors. |
Package middleware provides code that helps to integrate MemLimiter's backpressure subsystem with modern web frameworks.
|
Package middleware provides code that helps to integrate MemLimiter's backpressure subsystem with modern web frameworks. |
Package stats contains various data types describing service statistics MemLimiter relies on, as well as its own statistics.
|
Package stats contains various data types describing service statistics MemLimiter relies on, as well as its own statistics. |
test
|
|
allocator/app
Package app contains all the necessary things to build simple web application using MemLimiter.
|
Package app contains all the necessary things to build simple web application using MemLimiter. |
allocator/perf
Package perf contains performance client.
|
Package perf contains performance client. |
allocator/server
Package server is a simple GRPC service performing useless memory allocations.
|
Package server is a simple GRPC service performing useless memory allocations. |
allocator/tracker
Package tracker contains logic of service stats persistence.
|
Package tracker contains logic of service stats persistence. |
Package utils provides various utilities and helpers.
|
Package utils provides various utilities and helpers. |
breaker
Package breaker contains useful thread-safe abstraction the helps to control lifetime of actors, background tasks, pools etc.
|
Package breaker contains useful thread-safe abstraction the helps to control lifetime of actors, background tasks, pools etc. |
config/bytes
Package bytes helps to represent human-readable size values in JSON.
|
Package bytes helps to represent human-readable size values in JSON. |
config/duration
Package duration helps to represent human-readable duration values in JSON.
|
Package duration helps to represent human-readable duration values in JSON. |
config/prepare
Package prepare provides a function to validate configuration recursively.
|
Package prepare provides a function to validate configuration recursively. |
Click to show internal directories.
Click to hide internal directories.