Skip to content

perf(apps): cut idle database load from app workers, host tables and live revisions #659

Backlog

Description

@RentnerKev

Problem

Several loops hit the database while nothing changes.

  • readAppHostTables loads full proxy host summaries only to collect ids (web/src/server/AppRuntime/ui/host-table.server.ts:60-65). Each open host table repeats it every 20 s.
  • The app operation worker runs every second (web/src/server/AppRuntime/operations.server.ts:66) and takes lockProxyRuntimeSettings (an upsert plus a row lock, web/src/server/ProxyRuntime/proxy-runtime-settings.ts:62-72) before it checks whether any operation is open (operations.server.ts:365-388). That lock competes with proxy host and settings edits.
  • The proxy-hosts live revision is sampled every 2 s per websocket subscription (web/src/config/realtime.config.ts:31, web/src/server/WebSockets/realtimeSubscriptions.ts:180), and every application change triggers sampleAll (web/src/server/WebSockets/realtimeWebSocket.ts:220).
  • App event streams poll once per second while idle (web/src/server/AppRuntime/services.server.ts:138-157).

Proposal

  • Select only the ids the host table needs.
  • Check for open app operations without a lock first, and take the settings lock only when there is work.
  • Share one live revision sample per topic across all subscriptions, and sample only the topics an application change affects.
  • Follow-up: wake app event streams with LISTEN/NOTIFY instead of polling.

Acceptance

  • With no open operations and no changes, the worker takes no row locks.
  • N subscribers of the same topic cause one sample per interval, not N.

Found in the app platform audit of 2026-11-30.

Activity

  1. added
    enhancement
    area: database
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: databaseenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions