adaptive

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultInlineThreshold = 512
	InlineHardMin          = DefaultInlineThreshold
	InlineHardMax          = 2048
	DefaultStep            = 64
	UpdateInterval         = 100 // K commits

	// ZipperLeafLogOutputLaneStatsMax is the highest worker-selected leaf-log
	// lane index tracked directly in fixed-size apply metrics. Larger lane indexes
	// are folded into an overflow counter to avoid per-append maps or allocation.
	ZipperLeafLogOutputLaneStatsMax = 64
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller manages the adaptive inline threshold.

func New

func New() *Controller

func (*Controller) GetThreshold

func (c *Controller) GetThreshold() int

GetThreshold returns the current threshold to use for a new batch.

func (*Controller) RecordCommit

func (c *Controller) RecordCommit(m Metrics)

RecordCommit updates the controller with metrics from a completed commit.

type Metrics

type Metrics struct {
	LeafFill        float64 // 0..1
	Splits          int
	IndexWriteBytes int
	SlabWriteBytes  int
	SlabDeadBytes   int

	// ZipperApply* fields are coarse counters/timers gathered while applying a
	// batch to a B+Tree. Keep timings at scheduling/output boundaries rather than
	// in per-node recursion so benchmark reports do not add avoidable clock-read
	// overhead to the core apply path.
	ZipperApplyOps                       int
	ZipperNodeLoads                      int
	ZipperPagerNodeLoads                 int
	ZipperLeafLogNodeLoads               int
	ZipperLeafLogCacheHits               int
	ZipperLeafLogReaderCalls             int
	ZipperLeafLogViewReads               int
	ZipperLeafLogScratchReads            int
	ZipperPagerNodeBytesRead             int
	ZipperLeafLogNodeBytesRead           int
	ZipperLeafLogRecordHintBytesRead     int
	ZipperLeafMerges                     int
	ZipperInternalMerges                 int
	ZipperInternalParallelMerges         int
	ZipperInternalParallelChildren       int
	ZipperInternalParallelWorkers        int
	ZipperInternalParallelOps            int
	ZipperLeafPagesWritten               int
	ZipperPagerLeafPagesWritten          int
	ZipperLeafLogPagesWritten            int
	ZipperLeafPageBytesWritten           int
	ZipperPagerLeafPageBytesWritten      int
	ZipperLeafLogPageBytesWritten        int
	ZipperLeafLogRecordHintBytesWritten  int
	ZipperInternalPagesWritten           int
	ZipperInternalPageBytesWritten       int
	ZipperInternalChildRefs              int
	ZipperInternalPageChildRefs          int
	ZipperInternalLeafLogRefs            int
	ZipperInternalLeafLogRefCopies       int
	ZipperRootSplitLevels                int
	ZipperApplyWallNs                    int64
	ZipperRootReduceNs                   int64
	ZipperLeafLogOutputReservationWaitNs int64
	ZipperLeafLogOutputAppendWaitNs      int64
	ZipperLeafLogOutputAppendCalls       int
	ZipperLeafLogOutputAppendPages       int
	ZipperLeafLogOutputLaneTaskTotal     uint64
	ZipperLeafLogOutputLaneTasks         [ZipperLeafLogOutputLaneStatsMax + 1]uint64
	ZipperLeafLogOutputLaneTaskOverflow  uint64
	ZipperSpanNativeWorkerBusyNs         int64
	ZipperSpanNativeWorkerIdleNs         int64
	ZipperSpanNativeWorkerWaitNs         int64
	ZipperSpanNativeReadyTasks           int
	ZipperSpanNativeDispatchedTasks      int
	ZipperSpanNativeCompletedTasks       int
	ZipperSpanNativeQueueDepthMax        int
	ZipperSpanNativeScheduledWorkers     int
	ZipperSpanNativeScheduledWorkersMax  int
	ZipperSpanNativeTaskSpansTotal       int
	ZipperSpanNativeTaskSpansMin         int
	ZipperSpanNativeTaskSpansMax         int
	ZipperSpanNativeTaskOpsTotal         int
	ZipperSpanNativeTaskOpsMin           int
	ZipperSpanNativeTaskOpsMax           int
	ZipperSpanNativeTaskBytesTotal       int
	ZipperSpanNativeTaskBytesMin         int
	ZipperSpanNativeTaskBytesMax         int
	ZipperSpanNativeSingleSpanTasks      int

	// SlabWriteBytesByFile tracks bytes appended to each slab file during this
	// commit (keyed by FileID).
	SlabWriteBytesByFile map[uint32]int64
	// SlabDeadBytesByFile tracks bytes that became dead in each slab file during
	// this commit due to overwrite/delete of pointer values.
	SlabDeadBytesByFile map[uint32]int64
}

Metrics represents the telemetry gathered during a single commit.

Jump to

Keyboard shortcuts

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