feat: implement always-adaptive caching with getCacheStats monitoring
Replaces lazy mode concept with always-adaptive caching strategy:
- Rename getLazyModeStats() → getCacheStats() with enhanced metrics
- Change lazyModeEnabled boolean → cachingStrategy enum ('preloaded' | 'on-demand')
- Update preloading threshold from 30% to 80% for better cache utilization
- Add comprehensive production monitoring and diagnostics
- Add memory detection for containers (Docker/K8s cgroups v1/v2)
- Add adaptive memory sizing from 2GB to 128GB+ systems
Breaking changes: None (backward compatible, deprecated lazy option ignored)
New APIs:
- getCacheStats(): Comprehensive cache performance statistics
- cachingStrategy field: Transparent strategy reporting
- Enhanced fairness metrics and memory pressure monitoring
Documentation:
- Add migration guide for v3.36.0
- Add operations/capacity-planning.md for enterprise deployments
- Update all examples and troubleshooting guides
- Rename monitor-lazy-mode.ts → monitor-cache-performance.ts
This commit is contained in:
parent
6037db3d85
commit
46c6af3f21
17 changed files with 2737 additions and 127 deletions
|
|
@ -26,7 +26,7 @@ import { Brainy, NounType, VerbType } from '@soulcraft/brainy'
|
|||
|
||||
// Initialize
|
||||
const brain = new Brainy({
|
||||
storage: { type: 'memory' },
|
||||
storage: { type: 'filesystem', path: './brainy-data' },
|
||||
model: { type: 'fast', precision: 'Q8' }
|
||||
})
|
||||
await brain.init()
|
||||
|
|
@ -554,16 +554,7 @@ Brainy supports multiple storage backends for different deployment scenarios.
|
|||
|
||||
### Storage Types
|
||||
|
||||
#### Memory Storage (Default)
|
||||
Fast in-memory storage, ideal for testing and development.
|
||||
|
||||
```typescript
|
||||
const brain = new Brainy({
|
||||
storage: { type: 'memory' }
|
||||
})
|
||||
```
|
||||
|
||||
#### File System Storage
|
||||
#### File System Storage (Recommended for Development)
|
||||
Persistent local storage using the filesystem.
|
||||
|
||||
```typescript
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue