@@ -61,17 +61,30 @@ export interface PerformanceConfig {
61
61
cacheTTL : number
62
62
cacheMaxSize : number
63
63
cacheCleanupInterval : number
64
+
65
+ // Hierarchical cache settings
66
+ enableCacheHierarchy : boolean
67
+ l1CacheTTL : number // DataLoader cache
68
+ l2CacheTTL : number // NetworkDataCache
64
69
65
70
// Circuit breaker settings
66
71
enableCircuitBreaker : boolean
67
72
circuitBreakerFailureThreshold : number
68
73
circuitBreakerResetTimeout : number
69
74
circuitBreakerHalfOpenMaxAttempts : number
75
+
76
+ // Global circuit breaker settings
77
+ enableGlobalCircuitBreaker : boolean
78
+ perServiceCircuitBreakers : boolean
70
79
71
80
// Priority queue settings
72
81
enablePriorityQueue : boolean
73
82
priorityQueueSignalThreshold : string
74
83
priorityQueueStakeThreshold : string
84
+
85
+ // Intelligent batching settings
86
+ enableIntelligentBatching : boolean
87
+ batchPriorityWeighting : boolean
75
88
76
89
// Network settings
77
90
enableParallelNetworkQueries : boolean
@@ -87,6 +100,10 @@ export interface PerformanceConfig {
87
100
enableMetrics : boolean
88
101
metricsInterval : number
89
102
enableDetailedLogging : boolean
103
+
104
+ // Performance manager settings
105
+ enablePerformanceManager : boolean
106
+ performanceManagerWarmupEnabled : boolean
90
107
}
91
108
92
109
export const DEFAULT_PERFORMANCE_CONFIG : PerformanceConfig = {
@@ -101,6 +118,11 @@ export const DEFAULT_PERFORMANCE_CONFIG: PerformanceConfig = {
101
118
cacheTTL : PERFORMANCE_DEFAULTS . CACHE_TTL ,
102
119
cacheMaxSize : PERFORMANCE_DEFAULTS . CACHE_MAX_SIZE ,
103
120
cacheCleanupInterval : PERFORMANCE_DEFAULTS . CACHE_CLEANUP_INTERVAL ,
121
+
122
+ // Hierarchical cache settings
123
+ enableCacheHierarchy : true ,
124
+ l1CacheTTL : 5000 , // 5 seconds for request-scoped cache
125
+ l2CacheTTL : PERFORMANCE_DEFAULTS . CACHE_TTL , // 30 seconds for persistent cache
104
126
105
127
// Circuit breaker settings
106
128
enableCircuitBreaker : true ,
@@ -109,13 +131,21 @@ export const DEFAULT_PERFORMANCE_CONFIG: PerformanceConfig = {
109
131
circuitBreakerResetTimeout :
110
132
PERFORMANCE_DEFAULTS . CIRCUIT_BREAKER_RESET_TIMEOUT ,
111
133
circuitBreakerHalfOpenMaxAttempts : 3 ,
134
+
135
+ // Global circuit breaker settings
136
+ enableGlobalCircuitBreaker : true ,
137
+ perServiceCircuitBreakers : false ,
112
138
113
139
// Priority queue settings
114
140
enablePriorityQueue : true ,
115
141
priorityQueueSignalThreshold :
116
142
PERFORMANCE_DEFAULTS . PRIORITY_QUEUE_SIGNAL_THRESHOLD ,
117
143
priorityQueueStakeThreshold :
118
144
PERFORMANCE_DEFAULTS . PRIORITY_QUEUE_STAKE_THRESHOLD ,
145
+
146
+ // Intelligent batching settings
147
+ enableIntelligentBatching : true ,
148
+ batchPriorityWeighting : true ,
119
149
120
150
// Network settings
121
151
enableParallelNetworkQueries : true ,
@@ -131,6 +161,10 @@ export const DEFAULT_PERFORMANCE_CONFIG: PerformanceConfig = {
131
161
enableMetrics : true ,
132
162
metricsInterval : PERFORMANCE_DEFAULTS . METRICS_INTERVAL ,
133
163
enableDetailedLogging : false ,
164
+
165
+ // Performance manager settings
166
+ enablePerformanceManager : true ,
167
+ performanceManagerWarmupEnabled : true ,
134
168
}
135
169
136
170
/**
@@ -159,6 +193,18 @@ function applyCacheSettings(config: PerformanceConfig): void {
159
193
config . enableCache = parseEnvBoolean ( 'ENABLE_CACHE' , config . enableCache )
160
194
config . cacheTTL = parseEnvInt ( 'CACHE_TTL' , config . cacheTTL )
161
195
config . cacheMaxSize = parseEnvInt ( 'CACHE_MAX_SIZE' , config . cacheMaxSize )
196
+ config . cacheCleanupInterval = parseEnvInt (
197
+ 'CACHE_CLEANUP_INTERVAL' ,
198
+ config . cacheCleanupInterval ,
199
+ )
200
+
201
+ // Hierarchical cache settings
202
+ config . enableCacheHierarchy = parseEnvBoolean (
203
+ 'ENABLE_CACHE_HIERARCHY' ,
204
+ config . enableCacheHierarchy ,
205
+ )
206
+ config . l1CacheTTL = parseEnvInt ( 'L1_CACHE_TTL' , config . l1CacheTTL )
207
+ config . l2CacheTTL = parseEnvInt ( 'L2_CACHE_TTL' , config . l2CacheTTL )
162
208
}
163
209
164
210
/**
@@ -177,6 +223,20 @@ function applyCircuitBreakerSettings(config: PerformanceConfig): void {
177
223
'CIRCUIT_BREAKER_RESET_TIMEOUT' ,
178
224
config . circuitBreakerResetTimeout ,
179
225
)
226
+ config . circuitBreakerHalfOpenMaxAttempts = parseEnvInt (
227
+ 'CIRCUIT_BREAKER_HALF_OPEN_MAX_ATTEMPTS' ,
228
+ config . circuitBreakerHalfOpenMaxAttempts ,
229
+ )
230
+
231
+ // Global circuit breaker settings
232
+ config . enableGlobalCircuitBreaker = parseEnvBoolean (
233
+ 'ENABLE_GLOBAL_CIRCUIT_BREAKER' ,
234
+ config . enableGlobalCircuitBreaker ,
235
+ )
236
+ config . perServiceCircuitBreakers = parseEnvBoolean (
237
+ 'PER_SERVICE_CIRCUIT_BREAKERS' ,
238
+ config . perServiceCircuitBreakers ,
239
+ )
180
240
}
181
241
182
242
/**
@@ -195,6 +255,16 @@ function applyPriorityQueueSettings(config: PerformanceConfig): void {
195
255
'PRIORITY_QUEUE_STAKE_THRESHOLD' ,
196
256
config . priorityQueueStakeThreshold ,
197
257
)
258
+
259
+ // Intelligent batching settings
260
+ config . enableIntelligentBatching = parseEnvBoolean (
261
+ 'ENABLE_INTELLIGENT_BATCHING' ,
262
+ config . enableIntelligentBatching ,
263
+ )
264
+ config . batchPriorityWeighting = parseEnvBoolean (
265
+ 'BATCH_PRIORITY_WEIGHTING' ,
266
+ config . batchPriorityWeighting ,
267
+ )
198
268
}
199
269
200
270
/**
@@ -245,6 +315,20 @@ function applyMonitoringSettings(config: PerformanceConfig): void {
245
315
)
246
316
}
247
317
318
+ /**
319
+ * Apply performance manager settings
320
+ */
321
+ function applyPerformanceManagerSettings ( config : PerformanceConfig ) : void {
322
+ config . enablePerformanceManager = parseEnvBoolean (
323
+ 'ENABLE_PERFORMANCE_MANAGER' ,
324
+ config . enablePerformanceManager ,
325
+ )
326
+ config . performanceManagerWarmupEnabled = parseEnvBoolean (
327
+ 'PERFORMANCE_MANAGER_WARMUP_ENABLED' ,
328
+ config . performanceManagerWarmupEnabled ,
329
+ )
330
+ }
331
+
248
332
/**
249
333
* Load performance configuration from environment variables
250
334
*/
@@ -258,6 +342,7 @@ export function loadPerformanceConfig(): PerformanceConfig {
258
342
applyNetworkSettings ( config )
259
343
applyRetrySettings ( config )
260
344
applyMonitoringSettings ( config )
345
+ applyPerformanceManagerSettings ( config )
261
346
262
347
return config
263
348
}
0 commit comments