Documentation
¶
Index ¶
- Variables
- func CmdLinesToResp(cmds []CmdLine) []byte
- func FindBiggestKeys(rdbFilename string, topN int, output *os.File, options ...interface{}) error
- func FindHotKeys(rdbFilename string, topN int, output *os.File, options ...interface{}) error
- func FlameGraph(rdbFilename string, port int, separators []string, options ...interface{}) (chan<- struct{}, error)
- func MemoryProfile(rdbFilename string, csvFilename string, options ...interface{}) error
- func PrefixAnalyse(rdbFilename string, topN int, maxDepth int, output *os.File, ...) error
- func SepPrefixAnalyse(rdbFilename string, topN int, maxDepth int, separators []string, ...) error
- func ToAOF(rdbFilename string, aofFilename string, options ...interface{}) error
- func ToJsons(rdbFilename string, jsonFilename string, options ...interface{}) error
- func WriteObjectToResp(w io.Writer, obj model.RedisObject) error
- type CmdLine
- type ConcurrentOption
- type ExpirationOption
- type GlobalMetaOption
- type NoExpiredOption
- type RegexOption
- type SizeOption
- type Sized
Constants ¶
This section is empty.
Variables ¶
var TrimThreshold = 1000
TrimThreshold is the min count of keys to enable trim
Functions ¶
func CmdLinesToResp ¶
CmdLinesToResp convert []CmdLine to RESP bytes
func FindBiggestKeys ¶
FindBiggestKeys read rdb file and find the largest N keys. The invoker owns output, FindBiggestKeys won't close it
func FindHotKeys ¶ added in v1.3.2
FindHotKeys read rdb file and find the hottest N keys by LFU frequency.
IMPORTANT: This function only works when the RDB file was generated from a Redis instance configured with LFU eviction policy (maxmemory-policy allkeys-lfu or volatile-lfu). Under other eviction policies, the RDB file does not contain LFU frequency data, and the result will be empty.
Keys without LFU information are skipped. The invoker owns output, FindHotKeys won't close it.
func FlameGraph ¶
func FlameGraph(rdbFilename string, port int, separators []string, options ...interface{}) (chan<- struct{}, error)
FlameGraph draws flamegraph in web page to analysis memory usage pattern
func MemoryProfile ¶
MemoryProfile read rdb file and analysis memory usage then write result to csv file
func PrefixAnalyse ¶ added in v1.0.16
func PrefixAnalyse(rdbFilename string, topN int, maxDepth int, output *os.File, options ...interface{}) error
PrefixAnalyse read rdb file and find the largest N keys. The invoker owns output, FindBiggestKeys won't close it
func SepPrefixAnalyse ¶ added in v1.3.2
func SepPrefixAnalyse(rdbFilename string, topN int, maxDepth int, separators []string, output *os.File, options ...interface{}) error
SepPrefixAnalyse reads an RDB file and aggregates memory usage by key prefix using a flat map (constant memory). Keys are split by the given separators up to maxDepth. Multiple separators are normalized to the first one before splitting.
func WriteObjectToResp ¶ added in v1.0.5
func WriteObjectToResp(w io.Writer, obj model.RedisObject) error
WriteObjectToResp convert object to resp and write
Types ¶
type CmdLine ¶
type CmdLine = [][]byte
CmdLine is alias for [][]byte, represents a command line
func ObjectToCmd ¶
func ObjectToCmd(obj model.RedisObject, opts ...interface{}) []CmdLine
ObjectToCmd convert redis object to redis command line
type ConcurrentOption ¶ added in v1.1.0
type ConcurrentOption int
ConcurrentOption sets the number of goroutines for json converter
func WithConcurrent ¶ added in v1.1.0
func WithConcurrent(c int) ConcurrentOption
WithConcurrent sets the number of goroutines for json converter
type ExpirationOption ¶ added in v1.2.0
type ExpirationOption string
func WithExpirationOption ¶ added in v1.2.0
func WithExpirationOption(expr string) ExpirationOption
type GlobalMetaOption ¶ added in v1.3.1
type GlobalMetaOption bool
func WithGlobalMeta ¶ added in v1.3.1
func WithGlobalMeta() GlobalMetaOption
type NoExpiredOption ¶ added in v1.0.6
type NoExpiredOption bool
NoExpiredOption tells decoder to filter all expired keys
func WithNoExpiredOption ¶ added in v1.0.6
func WithNoExpiredOption() NoExpiredOption
WithNoExpiredOption tells decoder to filter all expired keys
type RegexOption ¶ added in v1.0.1
type RegexOption *string
RegexOption enable regex filters
func WithRegexOption ¶ added in v1.0.1
func WithRegexOption(expr string) RegexOption
WithRegexOption creates a WithRegexOption from regex expression
type SizeOption ¶ added in v1.3.1
type SizeOption string
SizeOption filters by object size
func WithSizeOption ¶ added in v1.3.1
func WithSizeOption(expr string) SizeOption
WithSizeOption creates a SizeOption from size expression expression format: "<min>~<max>", supports KB/MB/GB/TB/PB/EB units and 'inf'