tuning

package
v0.0.0-...-7a23388 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxAcceptPerEvent        = 128
	MaxReadBytesPerEvent     = 256 * 1024
	MaxFlushBytesPerEvent    = 256 * 1024
	MaxCmdPerEvent           = 1024
	MaxCmdFlushConnsPerEvent = 1024
	AcceptSocketNoDelay      = true
	AcceptSocketSendBufBytes = 0

	TlsHandshakeWorkers          = 0
	TlsHandshakeQueueSize        = 1024
	TlsHandshakeMaxPending int32 = 4096

	WriteQueueCoalesceMaxBytes = 128
	WriteQueueCompactMaxBytes  = 4 * 1024
	WriteQueueShrinkCap        = 4 * 1024

	DefProfiles = map[string]Profile{
		"balanced":   ProfileBalanced(),
		"throughput": ProfileThroughput(),
		"latency":    ProfileLatency(),
		"gateway":    ProfileGateway(),
	}
)

Live globals used by eventloop/connection.

View Source
var (
	// WSRequireClientMask enforces RFC6455: client->server frames must be masked.
	WSRequireClientMask = true

	// WSMaxFramePayloadBytes limits a single frame payload size.
	WSMaxFramePayloadBytes = 16 * 1024 * 1024

	// WSMaxMessageBytes limits a reassembled fragmented message size.
	WSMaxMessageBytes = 16 * 1024 * 1024
)

WebSocket knobs (0 = unlimited).

Functions

func Apply

func Apply(p Profile)

Apply overwrites globals.

func ApplyName

func ApplyName(name string) bool

ApplyName applies a built-in profile.

Types

type Connection

type Connection struct {
	WriteQueueCoalesceMaxBytes int // coalesce small writes
	WriteQueueCompactMaxBytes  int // compact tail
	WriteQueueShrinkCap        int // shrink items cap
}

Connection write-queue knobs.

type EventLoop

type EventLoop struct {
	MaxAcceptPerEvent        int   // accepts per poll
	MaxReadBytesPerEvent     int   // read bytes per poll
	MaxFlushBytesPerEvent    int   // flush bytes per poll
	MaxCmdPerEvent           int   // cmds per poll
	MaxCmdFlushConnsPerEvent int   // conns flushed per poll
	AcceptSocketNoDelay      bool  // set TCP_NODELAY on accepted sockets
	AcceptSocketSendBufBytes int   // set SO_SNDBUF on accepted sockets (0 = keep system default)
	TlsHandshakeWorkers      int   // handshake workers (0 => GOMAXPROCS)
	TlsHandshakeQueueSize    int   // handshake queue
	TlsHandshakeMaxPending   int32 // handshake cap
}

EventLoop budgets.

type Profile

type Profile struct {
	Name       string
	EventLoop  EventLoop
	Connection Connection
}

Profile is a preset.

func ProfileBalanced

func ProfileBalanced() Profile

ProfileBalanced keeps defaults.

func ProfileGateway

func ProfileGateway() Profile

ProfileGateway targets throughput with bounded tail latency.

func ProfileLatency

func ProfileLatency() Profile

ProfileLatency favors tail latency.

func ProfileThroughput

func ProfileThroughput() Profile

ProfileThroughput favors throughput.

Jump to

Keyboard shortcuts

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