servermemorylimit

package
v1.1.0-beta.0...-aa19d3f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MemoryMaxUsed                 = atomicutil.NewUint64(0)
	SessionKillLast               = atomicutil.NewTime(time.Time{})
	SessionKillTotal              = atomicutil.NewInt64(0)
	IsKilling                     = atomicutil.NewBool(false)
	GlobalMemoryOpsHistoryManager = &memoryOpsHistoryManager{}
)

Process global Observation indicators for memory limit.

Functions

This section is empty.

Types

type Handle

type Handle struct {
	// contains filtered or unexported fields
}

Handle is the handler for server memory limit.

func NewServerMemoryLimitHandle

func NewServerMemoryLimitHandle(exitCh chan struct{}) *Handle

NewServerMemoryLimitHandle builds a new server memory limit handler.

func (*Handle) Run

func (smqh *Handle) Run()

Run starts a server memory limit checker goroutine at the start time of the server. This goroutine will obtain the `heapInuse` of Golang runtime periodically and compare it with `tidb_server_memory_limit`. When `heapInuse` is greater than `tidb_server_memory_limit`, it will set the `needKill` flag of `MemUsageTop1Tracker`. When the corresponding SQL try to acquire more memory(next Tracker.Consume() call), it will trigger panic and exit. When this goroutine detects the `needKill` SQL has exited successfully, it will immediately trigger runtime.GC() to release memory resources.

func (*Handle) SetSessionManager

func (smqh *Handle) SetSessionManager(sm util.SessionManager) *Handle

SetSessionManager sets the SessionManager which is used to fetching the info of all active sessions.

Jump to

Keyboard shortcuts

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