Documentation
¶
Index ¶
- func ResetConfig()
- type ConfigTuner
- func (t *ConfigTuner) GetConfig() *TunerConfig
- func (t *ConfigTuner) GetLastTuneTime() time.Time
- func (t *ConfigTuner) GetMemoryProfiler() *profiling.MemoryProfiler
- func (t *ConfigTuner) GetRecommendations() []string
- func (t *ConfigTuner) GetTuneCount() int
- func (t *ConfigTuner) IsRunning() bool
- func (t *ConfigTuner) LoadConfigFromFile(filename string) error
- func (t *ConfigTuner) SaveConfigToFile(filename string) error
- func (t *ConfigTuner) SetConfig(config *TunerConfig)
- func (t *ConfigTuner) StartAutomaticTuning(interval time.Duration) error
- func (t *ConfigTuner) StopAutomaticTuning()
- func (t *ConfigTuner) TuneConfiguration()
- type Environment
- type MemoryConfig
- func (c *MemoryConfig) Clone() *MemoryConfig
- func (c *MemoryConfig) GetCustomConfig(key string) (interface{}, bool)
- func (c *MemoryConfig) GetEnvironment() Environment
- func (c *MemoryConfig) IsDevelopment() bool
- func (c *MemoryConfig) IsProduction() bool
- func (c *MemoryConfig) IsTesting() bool
- func (c *MemoryConfig) SaveConfig() error
- func (c *MemoryConfig) SetCustomConfig(key string, value interface{})
- func (c *MemoryConfig) SetEnvironment(env Environment)
- type StaticFileHandlerConfig
- type TunerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConfigTuner ¶
type ConfigTuner struct {
// contains filtered or unexported fields
}
ConfigTuner provides automatic configuration tuning based on system metrics
func NewConfigTuner ¶
func NewConfigTuner(config *TunerConfig, onConfigChange func(*TunerConfig)) (*ConfigTuner, error)
NewConfigTuner creates a new configuration tuner
func (*ConfigTuner) GetConfig ¶
func (t *ConfigTuner) GetConfig() *TunerConfig
GetConfig returns the current configuration
func (*ConfigTuner) GetLastTuneTime ¶
func (t *ConfigTuner) GetLastTuneTime() time.Time
GetLastTuneTime returns the time of the last tuning
func (*ConfigTuner) GetMemoryProfiler ¶
func (t *ConfigTuner) GetMemoryProfiler() *profiling.MemoryProfiler
GetMemoryProfiler returns the memory profiler
func (*ConfigTuner) GetRecommendations ¶
func (t *ConfigTuner) GetRecommendations() []string
GetRecommendations returns tuning recommendations
func (*ConfigTuner) GetTuneCount ¶
func (t *ConfigTuner) GetTuneCount() int
GetTuneCount returns the number of tuning operations
func (*ConfigTuner) IsRunning ¶
func (t *ConfigTuner) IsRunning() bool
IsRunning returns if automatic tuning is running
func (*ConfigTuner) LoadConfigFromFile ¶
func (t *ConfigTuner) LoadConfigFromFile(filename string) error
LoadConfigFromFile loads the configuration from a file
func (*ConfigTuner) SaveConfigToFile ¶
func (t *ConfigTuner) SaveConfigToFile(filename string) error
SaveConfigToFile saves the configuration to a file
func (*ConfigTuner) SetConfig ¶
func (t *ConfigTuner) SetConfig(config *TunerConfig)
SetConfig sets the configuration
func (*ConfigTuner) StartAutomaticTuning ¶
func (t *ConfigTuner) StartAutomaticTuning(interval time.Duration) error
StartAutomaticTuning starts automatic configuration tuning
func (*ConfigTuner) StopAutomaticTuning ¶
func (t *ConfigTuner) StopAutomaticTuning()
StopAutomaticTuning stops automatic configuration tuning
func (*ConfigTuner) TuneConfiguration ¶
func (t *ConfigTuner) TuneConfiguration()
TuneConfiguration tunes the configuration based on system metrics
type Environment ¶
type Environment string
Environment represents the application environment
const ( // Development environment Development Environment = "dev" // Testing environment Testing Environment = "test" // Production environment Production Environment = "prod" )
type MemoryConfig ¶
type MemoryConfig struct {
// Environment is the application environment
Environment Environment `json:"environment"`
// Memory Profiler Configuration
ProfilerEnabled bool `json:"profiler_enabled"`
ProfilerInterval int `json:"profiler_interval"` // In seconds
ProfilerOutputDir string `json:"profiler_output_dir"`
MemoryThreshold int64 `json:"memory_threshold"` // In MB
GCThreshold int64 `json:"gc_threshold"` // In ms
// Resource Pool Configuration
PoolManagerEnabled bool `json:"pool_manager_enabled"`
DefaultPoolSize int `json:"default_pool_size"`
MinPoolSize int `json:"min_pool_size"`
MaxPoolSize int `json:"max_pool_size"`
EnablePoolScaling bool `json:"enable_pool_scaling"`
ScaleUpThreshold float64 `json:"scale_up_threshold"` // 0.0-1.0
ScaleDownThreshold float64 `json:"scale_down_threshold"` // 0.0-1.0
// Memory Optimizer Configuration
MemoryOptimizerEnabled bool `json:"memory_optimizer_enabled"`
EnableDeduplication bool `json:"enable_deduplication"`
EnableCompression bool `json:"enable_compression"`
EnableLazyLoading bool `json:"enable_lazy_loading"`
EnableGCHints bool `json:"enable_gc_hints"`
// Inheritance Optimizer Configuration
InheritanceOptimizerEnabled bool `json:"inheritance_optimizer_enabled"`
MaxInheritanceDepth int `json:"max_inheritance_depth"`
FlattenInheritance bool `json:"flatten_inheritance"`
CacheOptimizedTemplates bool `json:"cache_optimized_templates"`
// Context Optimizer Configuration
ContextOptimizerEnabled bool `json:"context_optimizer_enabled"`
ContextDeduplication bool `json:"context_deduplication"`
ContextLazyLoading bool `json:"context_lazy_loading"`
ContextCompression bool `json:"context_compression"`
// Concurrency Configuration
ConcurrencyManagerEnabled bool `json:"concurrency_manager_enabled"`
MaxWorkers int `json:"max_workers"`
MinWorkers int `json:"min_workers"`
QueueSize int `json:"queue_size"`
WorkerIdleTimeout int `json:"worker_idle_timeout"` // In seconds
// Execution Optimizer Configuration
ExecutionOptimizerEnabled bool `json:"execution_optimizer_enabled"`
EnableBatchProcessing bool `json:"enable_batch_processing"`
BatchSize int `json:"batch_size"`
ResultCacheSize int `json:"result_cache_size"`
ResultCacheTTL int `json:"result_cache_ttl"` // In seconds
// Tuner Configuration
TunerEnabled bool `json:"tuner_enabled"`
GCPercent int `json:"gc_percent"`
MaxConcurrentRequests int `json:"max_concurrent_requests"`
ConnectionPoolSize int `json:"connection_pool_size"`
BufferPoolSize int `json:"buffer_pool_size"`
// Static File Handler Configuration
StaticFileHandler *StaticFileHandlerConfig `json:"static_file_handler"`
// Custom configuration by environment
CustomConfig map[string]interface{} `json:"custom_config"`
}
MemoryConfig represents configuration for memory optimization
func DefaultMemoryConfig ¶
func DefaultMemoryConfig() *MemoryConfig
DefaultMemoryConfig returns default configuration for memory optimization
func GetMemoryConfig ¶
func GetMemoryConfig() *MemoryConfig
GetMemoryConfig returns the memory configuration
func (*MemoryConfig) Clone ¶
func (c *MemoryConfig) Clone() *MemoryConfig
Clone creates a deep copy of the configuration
func (*MemoryConfig) GetCustomConfig ¶
func (c *MemoryConfig) GetCustomConfig(key string) (interface{}, bool)
GetCustomConfig gets a custom configuration value
func (*MemoryConfig) GetEnvironment ¶
func (c *MemoryConfig) GetEnvironment() Environment
GetEnvironment returns the current environment
func (*MemoryConfig) IsDevelopment ¶
func (c *MemoryConfig) IsDevelopment() bool
IsDevelopment returns true if the environment is development
func (*MemoryConfig) IsProduction ¶
func (c *MemoryConfig) IsProduction() bool
IsProduction returns true if the environment is production
func (*MemoryConfig) IsTesting ¶
func (c *MemoryConfig) IsTesting() bool
IsTesting returns true if the environment is testing
func (*MemoryConfig) SaveConfig ¶
func (c *MemoryConfig) SaveConfig() error
SaveConfig saves the memory configuration to a file
func (*MemoryConfig) SetCustomConfig ¶
func (c *MemoryConfig) SetCustomConfig(key string, value interface{})
SetCustomConfig sets a custom configuration value
func (*MemoryConfig) SetEnvironment ¶
func (c *MemoryConfig) SetEnvironment(env Environment)
SetEnvironment sets the environment
type StaticFileHandlerConfig ¶
type StaticFileHandlerConfig struct {
Enabled bool `json:"enabled"`
MaxFileSize int64 `json:"max_file_size"`
CacheEnabled bool `json:"cache_enabled"`
CacheTTL int `json:"cache_ttl"`
CompressionLevel int `json:"compression_level"`
}
StaticFileHandlerConfig represents configuration for static file handling
func DefaultStaticFileHandlerConfig ¶
func DefaultStaticFileHandlerConfig() *StaticFileHandlerConfig
DefaultStaticFileHandlerConfig returns default configuration for static file handler
type TunerConfig ¶
type TunerConfig struct {
// WorkerCount is the number of worker processes
WorkerCount int
// MaxConcurrentRequests is the maximum number of concurrent requests
MaxConcurrentRequests int
// ConnectionPoolSize is the size of the connection pool
ConnectionPoolSize int
// KeepAliveTimeout is the keep-alive timeout for connections
KeepAliveTimeout time.Duration
// ReadTimeout is the read timeout for requests
ReadTimeout time.Duration
// WriteTimeout is the write timeout for responses
WriteTimeout time.Duration
// IdleTimeout is the idle timeout for connections
IdleTimeout time.Duration
// MaxHeaderBytes is the maximum size of request headers
MaxHeaderBytes int
// BufferPoolSize is the size of the buffer pool
BufferPoolSize int
// TemplateCache is the size of the template cache
TemplateCache int
// StaticFileCache is the size of the static file cache
StaticFileCache int
// GzipCompression enables gzip compression
GzipCompression bool
// CompressionLevel is the compression level (1-9)
CompressionLevel int
// MaxRequestBodySize is the maximum size of request bodies
MaxRequestBodySize int64
// EnableHTTP2 enables HTTP/2
EnableHTTP2 bool
// GCPercent is the garbage collection target percentage
GCPercent int
// MaxMemory is the maximum memory usage (in MB)
MaxMemory int64
}
TunerConfig represents configuration for the tuner
func DefaultTunerConfig ¶
func DefaultTunerConfig() *TunerConfig
DefaultTunerConfig returns default configuration for the tuner