Files
32d70dd756 perf(cloud): cut event-loop hotspots found by profiling Cloud Core (#3036)
Cloud Core's main thread sat at 100% of one core while the 8-core node
was ~77% idle. A py-spy profile of production showed four avoidable
hotspots, each of which scaled with the number of Workspaces:

- Model list serializers scanned the whole runtime LLM cache (~125k
  models across ~3.4k Workspaces) once per model. Resolve the
  Workspace's runtime models once via the per-scope key index.
- Cloud model catalog sync reconciled every Workspace on every directory
  change. Directory-triggered passes now skip Workspaces whose desired
  state (catalog + owner key) is unchanged; a full reconcile still runs
  every sync interval to repair drift.
- Inline media TTL cleanup selected agent_run_event candidates globally,
  so every Workspace walked 100 other Workspaces' old events per hour,
  one transaction each. Candidates now come from the Workspace's own
  expired runs and only rows that can contain an inline image are
  visited.
- An unset storage.media_cache key logged two warnings per Workspace on
  every maintenance pass.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: multica-agent <github@multica.ai>
2026-11-15 00:50:20 +08:00
..