Repository navigation
feat(memory): add two-tier engine cache lifetime management and host RAM telemetry (#97, #98) - #100
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 1 (#97) (Engine & model cache lifetime management with configurable two-tier idle TTL and host RAM pressure relief) and Phase 2 (#98) (Host System RAM, Process Working Set, and Windows Non-Paged Kernel Pool telemetry + Unified Hardware Pill UI).
Closes #97
Closes #98
Phase 1: Two-Tier Idle Cache Eviction & Host RAM Pressure Relief (#97)
AppSettings.cs):ModelCacheIdleTimeoutMinutes(default:15,0 = disabled)EngineHibernationTimeoutMinutes(default:30,0 = disabled)RamPressureThresholdPercent(default:75, clamped50..95)VramOrchestrator.cs&Program.cs):ollama,comfy,forge,audio) both before and after proxy middleware execution (try...finally) and on explicit engine start endpoints.keep_alive = 0) and invokes ComfyUIPOST /free({"unload_models": true, "free_memory": true}).ComfyUI,SD Forge,Kokoro) while keepingLocalLLMServerManagerready to auto-wake them on the next request.>= 2 minuteswhen host physical RAM usage reaches or exceeds the configured threshold.MemoryLifecycleWatchdog.cs&EngineEndpoints.cs):MemoryLifecycleWatchdog(BackgroundService, 30s tick withTimeProvidersupport) to evaluate cache lifetimes continuously.POST /api/memory/purgeandPOST /api/v1/engines/purge-memory(PurgeAllMemoryCachesAsync) to force immediate model unload, idle engine hibernation, and managedGC.Collect(2, GCCollectionMode.Aggressive, true, true).Phase 2: Host RAM, Process Working Set & Kernel Pool Telemetry + UI (#98)
GpuTelemetryProvider.cs&IGpuTelemetryProvider.cs):GetSystemMemoryInfo()using WindowsGlobalMemoryStatusEx(kernel32.dll) andGetPerformanceInfo(psapi.dll) for host physical RAM and Windows Non-Paged Kernel Pool (KernelNonpaged), Linux/proc/meminfoparsing, andGC.GetGCMemoryInfo()fallback.LocalLLMServerManagerand managed child engine processes (ComfyProcess,ForgeProcess,AudioProcess,OllamaProcess)./api/gpu/vramand/api/v1/hardware/vramwithtotalRamBytes,usedRamBytes,totalRamGB,usedRamGB,ramPercent,processWorkingSetMB,nonPagedPoolMB, and active cache lifetime settings while preserving backward-compatible VRAM fields.TelemetryRibbonControl.axaml&SettingsTabControl.axaml):34pxtitlebar hardware pill to display dual compactVRAMandRAMprogress bars (VRAM 0.9/16.0G | RAM 14.8/31.7G), a rich multi-line breakdown tooltip (HardwareTooltipText), and a one-click Purge Memory button (PurgeMemoryCommand).SettingsTabControl.axaml(Engines & Pathscategory).Verification
npm run lint: 0 errorsnpx tsc --noEmit: 0 errorsdotnet test LocalLLMServerManager.Tests/LocalLLMServerManager.Tests.csproj: 935 passed, 0 failed, 18 skippedPlaywrightWasmE2ETests) verified across Chromium and Firefox (includingpage.reload(),<canvas>pixel verification,/api/gpu/vramschema validation, and Purge button click interaction).docs/images/dashboard_*.png, includingdashboard_settings_engines.png) regenerated and visually inspected.