Documentation ¶
Overview ¶
Package admissionpb contains the base types for the admission package. This is to prevent excess dependencies to util/log on sessiondatapb.
Index ¶
- Constants
- Variables
- type AdmissionWorkQueueStats
- func (*AdmissionWorkQueueStats) Descriptor() ([]byte, []int)
- func (m *AdmissionWorkQueueStats) Marshal() (dAtA []byte, err error)
- func (m *AdmissionWorkQueueStats) MarshalTo(dAtA []byte) (int, error)
- func (m *AdmissionWorkQueueStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*AdmissionWorkQueueStats) ProtoMessage()
- func (m *AdmissionWorkQueueStats) Reset()
- func (m *AdmissionWorkQueueStats) Size() (n int)
- func (m *AdmissionWorkQueueStats) String() string
- func (m *AdmissionWorkQueueStats) Unmarshal(dAtA []byte) error
- func (m *AdmissionWorkQueueStats) XXX_DiscardUnknown()
- func (m *AdmissionWorkQueueStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *AdmissionWorkQueueStats) XXX_Merge(src proto.Message)
- func (m *AdmissionWorkQueueStats) XXX_Size() int
- func (m *AdmissionWorkQueueStats) XXX_Unmarshal(b []byte) error
- type IOThreshold
- func (*IOThreshold) Descriptor() ([]byte, []int)
- func (m *IOThreshold) Marshal() (dAtA []byte, err error)
- func (m *IOThreshold) MarshalTo(dAtA []byte) (int, error)
- func (m *IOThreshold) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*IOThreshold) ProtoMessage()
- func (m *IOThreshold) Reset()
- func (iot *IOThreshold) SafeFormat(s interfaces.SafePrinter, _ rune)
- func (iot *IOThreshold) Score() (float64, bool)
- func (m *IOThreshold) Size() (n int)
- func (iot *IOThreshold) String() string
- func (m *IOThreshold) Unmarshal(dAtA []byte) error
- func (m *IOThreshold) XXX_DiscardUnknown()
- func (m *IOThreshold) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *IOThreshold) XXX_Merge(src proto.Message)
- func (m *IOThreshold) XXX_Size() int
- func (m *IOThreshold) XXX_Unmarshal(b []byte) error
- type WorkClass
- type WorkPriority
Constants ¶
const ( // LowPri is low priority work. LowPri WorkPriority = math.MinInt8 // TTLLowPri is low priority work from TTL internal submissions. TTLLowPri WorkPriority = -100 // UserLowPri is low priority work from user submissions (SQL). UserLowPri WorkPriority = -50 // BulkNormalPri is bulk priority work from bulk jobs, which could be run due // to user submissions or be automatic. BulkNormalPri WorkPriority = -30 // NormalPri is normal priority work. NormalPri WorkPriority = 0 // LockingNormalPri is used for user normal priority transactions that are // acquiring locks. LockingNormalPri WorkPriority = 10 // UserHighPri is high priority work from user submissions (SQL). UserHighPri WorkPriority = 50 // LockingUserHighPri is for user high priority transactions that are // acquiring locks. LockingUserHighPri WorkPriority = 100 // HighPri is high priority work. HighPri WorkPriority = math.MaxInt8 // OneAboveHighPri is one priority level above the highest priority. OneAboveHighPri int = int(HighPri) + 1 )
When adding to this list, remember to update the initialization logic of workPriorityToLockPriMap.
Variables ¶
var ( ErrInvalidLengthAdmissionStats = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowAdmissionStats = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupAdmissionStats = fmt.Errorf("proto: unexpected end of group") )
var ( ErrInvalidLengthIoThreshold = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowIoThreshold = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroupIoThreshold = fmt.Errorf("proto: unexpected end of group") )
var TestingReverseWorkPriorityDict map[string]WorkPriority
TestingReverseWorkPriorityDict is the reverse-lookup dictionary for WorkPriorityDict, for use in tests.
var WorkPriorityDict = map[WorkPriority]string{ LowPri: "low-pri", TTLLowPri: "ttl-low-pri", UserLowPri: "user-low-pri", BulkNormalPri: "bulk-normal-pri", NormalPri: "normal-pri", LockingNormalPri: "locking-normal-pri", UserHighPri: "user-high-pri", LockingUserHighPri: "locking-pri", HighPri: "high-pri", }
WorkPriorityDict is a mapping of the priorities to a short string name. The name is used as the suffix on exported work queue metrics.
Functions ¶
This section is empty.
Types ¶
type AdmissionWorkQueueStats ¶
type AdmissionWorkQueueStats struct { // Duration spent waiting. WaitDurationNanos time.Duration `` /* 138-byte string literal not displayed */ // String representation of admission queue kind. QueueKind string `protobuf:"bytes,2,opt,name=queue_kind,json=queueKind,proto3" json:"queue_kind,omitempty"` // Set to true if deadline was exceeded. DeadlineExceeded bool `protobuf:"varint,3,opt,name=deadline_exceeded,json=deadlineExceeded,proto3" json:"deadline_exceeded,omitempty"` // String representation of work priority. WorkPriority string `protobuf:"bytes,4,opt,name=work_priority,json=workPriority,proto3" json:"work_priority,omitempty"` }
AdmissionWorkQueueStats is recorded for work items waiting in the admission work queue.
func (*AdmissionWorkQueueStats) Descriptor ¶
func (*AdmissionWorkQueueStats) Descriptor() ([]byte, []int)
func (*AdmissionWorkQueueStats) Marshal ¶
func (m *AdmissionWorkQueueStats) Marshal() (dAtA []byte, err error)
func (*AdmissionWorkQueueStats) MarshalTo ¶
func (m *AdmissionWorkQueueStats) MarshalTo(dAtA []byte) (int, error)
func (*AdmissionWorkQueueStats) MarshalToSizedBuffer ¶
func (m *AdmissionWorkQueueStats) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*AdmissionWorkQueueStats) ProtoMessage ¶
func (*AdmissionWorkQueueStats) ProtoMessage()
func (*AdmissionWorkQueueStats) Reset ¶
func (m *AdmissionWorkQueueStats) Reset()
func (*AdmissionWorkQueueStats) Size ¶
func (m *AdmissionWorkQueueStats) Size() (n int)
func (*AdmissionWorkQueueStats) String ¶
func (m *AdmissionWorkQueueStats) String() string
func (*AdmissionWorkQueueStats) Unmarshal ¶
func (m *AdmissionWorkQueueStats) Unmarshal(dAtA []byte) error
func (*AdmissionWorkQueueStats) XXX_DiscardUnknown ¶
func (m *AdmissionWorkQueueStats) XXX_DiscardUnknown()
func (*AdmissionWorkQueueStats) XXX_Marshal ¶
func (m *AdmissionWorkQueueStats) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AdmissionWorkQueueStats) XXX_Merge ¶
func (m *AdmissionWorkQueueStats) XXX_Merge(src proto.Message)
func (*AdmissionWorkQueueStats) XXX_Size ¶
func (m *AdmissionWorkQueueStats) XXX_Size() int
func (*AdmissionWorkQueueStats) XXX_Unmarshal ¶
func (m *AdmissionWorkQueueStats) XXX_Unmarshal(b []byte) error
type IOThreshold ¶
type IOThreshold struct { L0NumSubLevels int64 `protobuf:"varint,1,opt,name=l0_num_sub_levels,json=l0NumSubLevels,proto3" json:"l0_num_sub_levels,omitempty"` L0NumSubLevelsThreshold int64 `` /* 137-byte string literal not displayed */ L0NumFiles int64 `protobuf:"varint,3,opt,name=l0_num_files,json=l0NumFiles,proto3" json:"l0_num_files,omitempty"` L0NumFilesThreshold int64 `protobuf:"varint,4,opt,name=l0_num_files_threshold,json=l0NumFilesThreshold,proto3" json:"l0_num_files_threshold,omitempty"` L0Size int64 `protobuf:"varint,5,opt,name=l0_size,json=l0Size,proto3" json:"l0_size,omitempty"` L0MinimumSizePerSubLevel int64 `` /* 142-byte string literal not displayed */ }
IOThreshold wraps the raw signals that IO admission control utilizes to determine when to introduce queueing.
func (*IOThreshold) Descriptor ¶
func (*IOThreshold) Descriptor() ([]byte, []int)
func (*IOThreshold) Marshal ¶
func (m *IOThreshold) Marshal() (dAtA []byte, err error)
func (*IOThreshold) MarshalToSizedBuffer ¶
func (m *IOThreshold) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*IOThreshold) ProtoMessage ¶
func (*IOThreshold) ProtoMessage()
func (*IOThreshold) Reset ¶
func (m *IOThreshold) Reset()
func (*IOThreshold) SafeFormat ¶
func (iot *IOThreshold) SafeFormat(s interfaces.SafePrinter, _ rune)
SafeFormat implements redact.SafeFormatter.
func (*IOThreshold) Score ¶
func (iot *IOThreshold) Score() (float64, bool)
Score returns, as the second return value, whether IO admission control is considering the Store overloaded wrt compaction of L0. The first return value is a 1-normalized float (i.e. 1.0 is the threshold at which the second value flips to true).
The zero value returns (0, false). Use of the nil pointer is not allowed.
TODO(sumeer): consider whether we need to enhance this to incorporate overloading via flush bandwidth. I suspect we can get away without incorporating flush bandwidth since typically chronic overload will be due to compactions falling behind (though that may change if we increase the max number of compactions). And we will need to incorporate overload due to disk bandwidth bottleneck.
func (*IOThreshold) Size ¶
func (m *IOThreshold) Size() (n int)
func (*IOThreshold) String ¶
func (iot *IOThreshold) String() string
func (*IOThreshold) Unmarshal ¶
func (m *IOThreshold) Unmarshal(dAtA []byte) error
func (*IOThreshold) XXX_DiscardUnknown ¶
func (m *IOThreshold) XXX_DiscardUnknown()
func (*IOThreshold) XXX_Marshal ¶
func (m *IOThreshold) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*IOThreshold) XXX_Merge ¶
func (m *IOThreshold) XXX_Merge(src proto.Message)
func (*IOThreshold) XXX_Size ¶
func (m *IOThreshold) XXX_Size() int
func (*IOThreshold) XXX_Unmarshal ¶
func (m *IOThreshold) XXX_Unmarshal(b []byte) error
type WorkClass ¶
type WorkClass int8
WorkClass represents the class of work, which is defined entirely by its WorkPriority. Namely, everything less than NormalPri is defined to be "Elastic", while everything above and including NormalPri is considered "Regular.
const ( // RegularWorkClass is for work corresponding to workloads that are // throughput and latency sensitive. RegularWorkClass WorkClass = iota // ElasticWorkClass is for work corresponding to workloads that can handle // reduced throughput, possibly by taking longer to finish a workload. It is // not latency sensitive. ElasticWorkClass // NumWorkClasses is the number of work classes. NumWorkClasses )
func WorkClassFromPri ¶
func WorkClassFromPri(pri WorkPriority) WorkClass
WorkClassFromPri translates a WorkPriority to its given WorkClass.
func (WorkClass) SafeFormat ¶
func (w WorkClass) SafeFormat(p redact.SafePrinter, verb rune)
SafeFormat implements the redact.SafeFormatter interface.
type WorkPriority ¶
type WorkPriority int8
WorkPriority represents the priority of work. In an WorkQueue, it is only used for ordering within a tenant. High priority work can starve lower priority work.
func AdjustedPriorityWhenHoldingLocks ¶
func AdjustedPriorityWhenHoldingLocks(pri WorkPriority) WorkPriority
AdjustedPriorityWhenHoldingLocks takes the original priority of a transaction and updates it under the knowledge that the transaction is holding locks.
This broader context of locking is technically not in scope of the admission package, but we define this function here as the WorkPriority enum values are defined here.
For example, UserLowPri should map to BulkNormalPri (see the hack below), NormalPri maps to LockingNormalPri, and UserHighPri maps to LockingUserHighPri. Say users are running at these different priorities in different parts of the key space, say key-low, key-normal, key-high, then even after the mapping, a txn holding locks (or resolving intents) in key-low will have lower priority (BulkNormalPri) than the non-adjusted priority in key-normal (NormalPri). The same holds true for txn holding locks in key-normal, since LockingNormalPri is lower priority than UserHighPri.
Adjusting the priority can also be beneficial when all txns have the same QoS requirements, but there is lock contention. In tpcc with 3000 warehouses, it halved the number of lock waiters, and increased the transaction throughput by 10+%. In that experiment 40% of the BatchRequests evaluated by KV had been assigned a higher priority due to locking.
func (WorkPriority) SafeFormat ¶
func (w WorkPriority) SafeFormat(p redact.SafePrinter, verb rune)
SafeFormat implements the redact.SafeFormatter interface.
func (WorkPriority) String ¶
func (w WorkPriority) String() string