autoconfig

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 3 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DBTypeGroupReplication = mysqlcalc.DbTypeGroupReplication
	DBTypeAsync            = mysqlcalc.DbTypeAsync
	DBTypePXC              = mysqlcalc.DbTypePXC
)

DB replication topologies accepted by Request.DBType.

View Source
const (
	LoadTypeMostlyReads      = mysqlcalc.LoadTypeMostlyReads      // ~95% reads
	LoadTypeSomeWrites       = mysqlcalc.LoadTypeSomeWrites       // ~80% reads
	LoadTypeEqualReadsWrites = mysqlcalc.LoadTypeEqualReadsWrites // ~50/50
	LoadTypeHeavyWrites      = mysqlcalc.LoadTypeHeavyWrites      // write dominated
)

Workload read/write profiles accepted by Request.LoadType.

Variables

View Source
var (
	ErrMemoryRequired = errors.New("memory is required")
	ErrCPURequired    = errors.New("cpu is required")
	// outside its supported range the calculator returns an empty
	// configuration rather than an error
	ErrVersionUnsupported = errors.New("mysql version is out of the supported range")
)
View Source
var (
	MinSupportedVersion = Version{
		Major: mysqlcalc.MySQLMinSupported.Major,
		Minor: mysqlcalc.MySQLMinSupported.Minor,
		Patch: mysqlcalc.MySQLMinSupported.Patch,
	}
	MaxSupportedVersion = Version{
		Major: mysqlcalc.MySQLMaxSupported.Major,
		Minor: mysqlcalc.MySQLMaxSupported.Minor,
		Patch: mysqlcalc.MySQLMaxSupported.Patch,
	}
)

MinSupportedVersion and MaxSupportedVersion mirror the bounds the calculator filters its parameters by.

Functions

This section is empty.

Types

type Request

type Request struct {
	// DBType is the replication topology (one of the DBType* constants).
	// Defaults to group replication.
	DBType string
	// CPU is the CPU allocation for the whole pod in millicores (e.g. 4000 = 4 cores).
	CPU int
	// Memory is the memory allocation for the whole pod as a human-readable
	// string, e.g. "2.5G". Ignored when MemoryBytes is set.
	Memory string
	// MemoryBytes is the memory allocation for the whole pod in bytes. When
	// greater than zero it takes precedence over Memory.
	MemoryBytes int64
	// Connections is the target number of client connections.
	Connections int
	// Version is the MySQL server version being configured.
	Version Version
	// LoadType selects the read/write profile (one of the LoadType* constants).
	// Defaults to LoadTypeSomeWrites.
	LoadType int
	// ProviderCostPct optionally reserves a fraction (0..1) of the allocated
	// resources to account for provider overhead. Zero disables the adjustment.
	ProviderCostPct float64
	// SharedResources declares that CPU and Memory are a budget mysqld shares
	// with the proxy and monitoring components. The operator gives those their
	// own allocations, so its request leaves this at the zero value.
	SharedResources bool
}

Request describes the workload MySQL is tuned for. Only CPU and Memory are required.

type Result

type Result struct {
	// Message is the calculator's status message (warnings, notes). A MType > 0
	// signals the caller may want to log it.
	Message mysqlcalc.ResponseMessage
	// Families is the raw calculator output, keyed by family (mysql, proxy,
	// monitor), for callers that need groups beyond mysqld.
	Families map[string]mysqlcalc.Family
	// contains filtered or unexported fields
}

Result holds the outcome of a Calculate call.

func Calculate

func Calculate(req Request) (*Result, error)

Calculate runs the operator calculator for the given request.

func (*Result) MySQLdConfig

func (r *Result) MySQLdConfig() (string, error)

MySQLdConfig returns the tuned mysqld parameters as an INI section.

func (*Result) MySQLdParams

func (r *Result) MySQLdParams() (map[string]string, error)

MySQLdParams returns the tuned mysqld parameters as a name/value map.

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

Version identifies the target MySQL server version.

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL