Skip to content

Improve Dokploy memory efficiency for low-memory VPS tiers on single-node self-hosted instances #3909

@jhon2c

Description

@jhon2c

What problem will this feature address?

Dokploy memory usage has increased and this heavily impacts single-node self-hosted instances on low-memory VPS plans (including 4GB RAM class and smaller), causing instability, higher swap pressure when available, and occasional OOM crashs and restarts even under normal usage.

Describe the solution you'd like

Implement a memory-optimization initiative with these changes:

  1. Monitoring runtime refactor
  • Replace async setInterval polling loops with non-overlapping execution.
  • Use shared per-app collectors for WebSocket subscribers instead of one collector per connection.
  • Add adaptive sampling/backoff under pressure (heap growth / event loop lag).
  • Enforce in-flight limits so stale ticks are dropped instead of queued.
  1. Scheduler right-sizing
  • Make worker count and concurrency configurable.
  • Reduce default scheduler parallelism for low-memory profiles.
  • Keep high-throughput mode as an explicit opt-in.
  1. Monitoring API/data-path hardening
  • Remove unbounded limit=all behavior in hot monitoring endpoints.
  • Enforce bounded limits and add pagination for historical reads.
  • Improve retention and storage behavior to reduce allocation churn.
  1. Runtime baseline reduction
  • Introduce a low-memory profile preset.
  • Add conservative Node memory caps for auxiliary services.
  • Add memory reservations/limits for Dokploy internal services where possible.
  • Reduce runtime module load by avoiding broad barrel imports in hot paths.

Describe alternatives you've considered

  • Keeping current behavior and asking users to scale VPS size: avoids engineering work but does not solve efficiency regressions.
  • Disabling monitoring by on high memory pressure: reduces memory but degrades product value.
  • Minor tuning only (GC/env tweaks): helpful, but unlikely to be enough without code-path and API changes.

Additional context

Acceptance criteria expected:

  • No OOM/restart events in a 24h soak test on low-memory VPS nodes.
  • Stable RSS after warm-up for Dokploy core services.
  • Monitoring remains functional with adaptive sampling.
  • Scheduler/backups/deployments continue to run correctly with new defaults.

Will you send a PR to implement it?

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions