profile

package
v0.4.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AutoProfileName = "auto"
	CfgUseProfile   = "useProfile"
)

Variables

View Source
var (
	ErrNotEnoughMemory = errors.New("not enough system memory")
)
View Source
var Profile1GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		FirstSeenTx: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 2000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		RefsInvalidBundle: CacheOpts{
			CacheTimeMs: 180000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
	Badger: BadgerOpts{
		LevelOneSize:            67108864,
		LevelSizeMultiplier:     10,
		TableLoadingMode:        options.FileIO,
		ValueLogLoadingMode:     options.FileIO,
		MaxLevels:               5,
		MaxTableSize:            16777216,
		NumCompactors:           1,
		NumLevelZeroTables:      1,
		NumLevelZeroTablesStall: 2,
		NumMemtables:            1,
		BloomFalsePositive:      0.01,
		BlockSize:               4 * 1024,
		SyncWrites:              false,
		NumVersionsToKeep:       1,
		CompactLevel0OnClose:    false,
		KeepL0InMemory:          false,
		VerifyValueChecksum:     false,
		MaxCacheSize:            50000000,
		ZSTDCompressionLevel:    1,
		CompressionType:         options.None,
		ValueLogFileSize:        67108863,
		ValueLogMaxEntries:      2097151,
		ValueThreshold:          32,
		WithTruncate:            false,
		LogRotatesToFlush:       2,
		EventLogging:            false,
	},
}
View Source
var Profile2GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 200,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 200,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 1500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 2500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		FirstSeenTx: CacheOpts{
			CacheTimeMs: 100,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 2500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		RefsInvalidBundle: CacheOpts{
			CacheTimeMs: 180000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
	Badger: BadgerOpts{
		LevelOneSize:            268435456,
		LevelSizeMultiplier:     10,
		TableLoadingMode:        options.FileIO,
		ValueLogLoadingMode:     options.FileIO,
		MaxLevels:               7,
		MaxTableSize:            67108864,
		NumCompactors:           1,
		NumLevelZeroTables:      1,
		NumLevelZeroTablesStall: 2,
		NumMemtables:            1,
		BloomFalsePositive:      0.01,
		BlockSize:               4 * 1024,
		SyncWrites:              false,
		NumVersionsToKeep:       1,
		CompactLevel0OnClose:    false,
		KeepL0InMemory:          false,
		VerifyValueChecksum:     false,
		MaxCacheSize:            50000000,
		ZSTDCompressionLevel:    1,
		CompressionType:         options.None,
		ValueLogFileSize:        1073741823,
		ValueLogMaxEntries:      33554431,
		ValueThreshold:          32,
		WithTruncate:            false,
		LogRotatesToFlush:       2,
		EventLogging:            false,
	},
}
View Source
var Profile4GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 15000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		FirstSeenTx: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		RefsInvalidBundle: CacheOpts{
			CacheTimeMs: 180000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
	Badger: BadgerOpts{
		LevelOneSize:            268435456,
		LevelSizeMultiplier:     10,
		TableLoadingMode:        options.FileIO,
		ValueLogLoadingMode:     options.FileIO,
		MaxLevels:               7,
		MaxTableSize:            67108864,
		NumCompactors:           1,
		NumLevelZeroTables:      1,
		NumLevelZeroTablesStall: 2,
		NumMemtables:            1,
		BloomFalsePositive:      0.01,
		BlockSize:               4 * 1024,
		SyncWrites:              false,
		NumVersionsToKeep:       1,
		CompactLevel0OnClose:    false,
		KeepL0InMemory:          false,
		VerifyValueChecksum:     false,
		MaxCacheSize:            100000000,
		ZSTDCompressionLevel:    1,
		CompressionType:         options.None,
		ValueLogFileSize:        1073741823,
		ValueLogMaxEntries:      33554431,
		ValueThreshold:          32,
		WithTruncate:            false,
		LogRotatesToFlush:       2,
		EventLogging:            false,
	},
}
View Source
var Profile8GB = &Profile{
	Caches: Caches{
		Addresses: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Approvers: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Tags: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Bundles: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		BundleTransactions: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Milestones: CacheOpts{
			CacheTimeMs: 10000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		Transactions: CacheOpts{
			CacheTimeMs: 30000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		FirstSeenTx: CacheOpts{
			CacheTimeMs: 500,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		IncomingTransactionFilter: CacheOpts{
			CacheTimeMs: 5000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		RefsInvalidBundle: CacheOpts{
			CacheTimeMs: 180000,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
		SpentAddresses: CacheOpts{
			CacheTimeMs: 0,
			LeakDetectionOptions: LeakDetectionOpts{
				Enabled:                false,
				MaxConsumersPerObject:  20,
				MaxConsumerHoldTimeSec: 100,
			},
		},
	},
	Badger: BadgerOpts{
		LevelOneSize:            268435456,
		LevelSizeMultiplier:     10,
		TableLoadingMode:        options.MemoryMap,
		ValueLogLoadingMode:     options.FileIO,
		MaxLevels:               7,
		MaxTableSize:            67108864,
		NumCompactors:           1,
		NumLevelZeroTables:      1,
		NumLevelZeroTablesStall: 2,
		NumMemtables:            1,
		BloomFalsePositive:      0.01,
		BlockSize:               4 * 1024,
		SyncWrites:              false,
		NumVersionsToKeep:       1,
		CompactLevel0OnClose:    false,
		KeepL0InMemory:          false,
		VerifyValueChecksum:     false,
		MaxCacheSize:            200000000,
		ZSTDCompressionLevel:    1,
		CompressionType:         options.None,
		ValueLogFileSize:        1073741823,
		ValueLogMaxEntries:      33554431,
		ValueThreshold:          32,
		WithTruncate:            false,
		LogRotatesToFlush:       2,
		EventLogging:            false,
	},
}

Functions

This section is empty.

Types

type BadgerOpts

type BadgerOpts struct {
	LevelOneSize            int64                   `mapstructure:"levelOneSize"`
	LevelSizeMultiplier     int                     `mapstructure:"levelSizeMultiplier"`
	TableLoadingMode        options.FileLoadingMode `mapstructure:"tableLoadingMode"`
	ValueLogLoadingMode     options.FileLoadingMode `mapstructure:"valueLogLoadingMode"`
	MaxLevels               int                     `mapstructure:"maxLevels"`
	MaxTableSize            int64                   `mapstructure:"maxTableSize"`
	NumCompactors           int                     `mapstructure:"numCompactors"`
	NumLevelZeroTables      int                     `mapstructure:"numLevelZeroTables"`
	NumLevelZeroTablesStall int                     `mapstructure:"numLevelZeroTablesStall"`
	NumMemtables            int                     `mapstructure:"numMemtables"`
	BloomFalsePositive      float64                 `mapstructure:"bloomFalsePositive"`
	BlockSize               int                     `mapstructure:"blockSize"`
	SyncWrites              bool                    `mapstructure:"syncWrites"`
	NumVersionsToKeep       int                     `mapstructure:"numVersionsToKeep"`
	CompactLevel0OnClose    bool                    `mapstructure:"compactLevel0OnClose"`
	KeepL0InMemory          bool                    `mapstructure:"keepL0InMemory"`
	VerifyValueChecksum     bool                    `mapstructure:"verifyValueChecksum"`
	MaxCacheSize            int64                   `mapstructure:"maxCacheSize"`
	ZSTDCompressionLevel    int                     `mapstructure:"ZSTDCompressionLevel"`
	CompressionType         options.CompressionType `mapstructure:"CompressionType"`
	ValueLogFileSize        int64                   `mapstructure:"valueLogFileSize"`
	ValueLogMaxEntries      uint32                  `mapstructure:"valueLogMaxEntries"`
	ValueThreshold          int                     `mapstructure:"valueThreshold"`
	WithTruncate            bool                    `mapstructure:"withTruncate"`
	LogRotatesToFlush       int32                   `mapstructure:"logRotatesToFlush"`
	EventLogging            bool                    `mapstructure:"eventLogging"`
}

type CacheOpts

type CacheOpts struct {
	CacheTimeMs          uint64            `mapstructure:"cacheTimeMs"`
	LeakDetectionOptions LeakDetectionOpts `mapstructure:"leakDetection"`
}

type Caches

type Caches struct {
	Addresses                 CacheOpts `mapstructure:"addresses"`
	Bundles                   CacheOpts `mapstructure:"bundles"`
	BundleTransactions        CacheOpts `mapstructure:"bundleTransactions"`
	Approvers                 CacheOpts `mapstructure:"approvers"`
	Tags                      CacheOpts `mapstructure:"tags"`
	Milestones                CacheOpts `mapstructure:"milestones"`
	Transactions              CacheOpts `mapstructure:"transactions"`
	IncomingTransactionFilter CacheOpts `mapstructure:"incomingTransactionFilter"`
	RefsInvalidBundle         CacheOpts `mapstructure:"refsInvalidBundle"`
	FirstSeenTx               CacheOpts `mapstructure:"firstSeenTx"`
	SpentAddresses            CacheOpts `mapstructure:"spentAddresses"`
}

type LeakDetectionOpts

type LeakDetectionOpts struct {
	Enabled                bool   `mapstructure:"enabled"`
	MaxConsumersPerObject  int    `mapstructure:"maxConsumersPerObject"`
	MaxConsumerHoldTimeSec uint64 `mapstructure:"maxConsumerHoldTimeSec"`
}

type Profile

type Profile struct {
	Name   string     `mapstructure:"name"`
	Caches Caches     `mapstructure:"caches"`
	Badger BadgerOpts `mapstructure:"badger"`
}

func LoadProfile

func LoadProfile() *Profile

LoadProfile automatically loads the appropriate profile (given the system memory) if the config value is set to 'auto' or the one specified in the config.

Jump to

Keyboard shortcuts

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