-
-
Notifications
You must be signed in to change notification settings - Fork 67
PerformanceTuning.md
Chris edited this page Jun 22, 2025
·
3 revisions
DockFlare includes several features designed to ensure it runs efficiently, provides a responsive user experience, and respects Cloudflare API rate limits, especially in environments with many containers.
These features are designed to minimize unnecessary API calls and prevent errors from Cloudflare.
- Problem: When many containers start or stop at once, DockFlare could try to create or delete numerous DNS records simultaneously, potentially hitting Cloudflare's API rate limits.
- Solution: DockFlare uses a semaphore to limit the number of DNS operations that can run in parallel.
-
Configuration:
-
MAX_CONCURRENT_DNS_OPS: The environment variable controlling the maximum number of simultaneous DNS operations. -
Default:
3. You can cautiously increase this if you have high API limits or decrease it to1or2if you encounter rate-limiting errors.
-
- Problem: Pushing the entire tunnel configuration to Cloudflare on every minor change is inefficient.
-
Solution: Before sending an update, DockFlare generates a "fingerprint" of its desired ingress rule configuration and compares it to the fingerprint of the configuration currently live on Cloudflare. An API
PUTrequest is only sent if a change is actually detected. - Benefit: This drastically reduces API traffic and speeds up operations, as no updates are sent if the state is already consistent.
- Problem: Repeatedly asking for the same information, like a Zone ID for a domain, is redundant.
- Solution: DockFlare caches frequently requested, non-volatile information (like Zone IDs) in memory for a short period.
-
Benefit: This reduces latency and the number of
GETrequests made to the Cloudflare API.
These features ensure the application starts quickly and handles large numbers of containers without getting bogged down.
- Problem: On startup, scanning hundreds of containers sequentially can be slow.
- Solution: DockFlare processes the initial list of containers in small batches. This allows the application to remain responsive and provide progress feedback in the UI during a large initial scan.
-
Configuration:
-
RECONCILIATION_BATCH_SIZE: The environment variable controlling how many containers are processed in each batch during the startup scan. -
Default:
5.
-
- Problem: Waiting for all initialization tasks (connecting to APIs, scanning containers, reconciling state) to complete before the UI is available can be inconvenient.
- Solution: DockFlare's Web UI starts almost immediately, while the more intensive initialization and reconciliation tasks run in a background thread.
- Benefit: You can access the UI and see live logs right away, with status indicators showing the current state of the application (e.g., "Initializing", "Initial container scan...", "Running").