runtime

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeqShardCount = 12 * 4 // 分片数,降低锁竞争
	SeqWindowSize = 4096   // 最大允许的序列号窗口
)
View Source
const (
	GOOS = runtime.GOOS
)

Variables

View Source
var (
	ParentCpus  = make([]int, 0) // 父进程cpus
	IdleCpus    = make([]int, 0) // 空闲cpus
	TotalMemory = uint64(0)      // 总内存大小 kb
	NumCPU      = runtime.NumCPU // 总cpus
)

Functions

func G_output

func G_output() chan []byte

func Init

func Init(ctx context.Context)

func LoadBalancePut

func LoadBalancePut(bytes []byte) error

func WeightPut

func WeightPut(bytes []byte) error

Types

type Dispatcher

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

func (*Dispatcher) SelectWorker

func (d *Dispatcher) SelectWorker() *Metrics

增强型选择算法

func (*Dispatcher) UpdateWeights

func (d *Dispatcher) UpdateWeights(newWeights map[int]float64)

权重平滑迁移

type G

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

type M

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

func (*M) Cease

func (m *M) Cease()

type MapReduce

type MapReduce struct {
}

type Metrics

type Metrics struct {
	PID         int
	CPUUsage    float64   // 最近1秒平均CPU使用率[0-100]
	MemUsage    uint64    // RSS内存占用(bytes)
	MemPercent  float64   // 内存使用百分比[0-100]
	Pending     int       // 待处理任务数
	LastUpdated time.Time // 最后更新时间
}

func (*Metrics) Reset

func (m *Metrics) Reset()

func (*Metrics) Update

func (m *Metrics) Update()

更新指标数据

type P

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

type Sched

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

func (*Sched) SetStrategy

func (s *Sched) SetStrategy(strategy string)

type SeqShard

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

type SequenceManager

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

func NewSequenceManager

func NewSequenceManager() *SequenceManager

func (*SequenceManager) Close

func (sm *SequenceManager) Close()

func (*SequenceManager) Submit

func (sm *SequenceManager) Submit(seq uint64, data []byte)

按序列号分片提交

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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