feat(docker): add toggle to enable/disable permanent browser instance #1676
+9
−4
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
This PR adds a new configuration option
use_permanentto the Docker deployment mode.Problem: Currently, a permanent browser instance is always initialized at startup, which consumes roughly 200MB-300MB of memory regardless of actual usage. In resource-constrained environments or high-concurrency stress tests, this persistent instance contributes to memory accumulation and potential OOM (Out Of Memory) issues.
Solution: By introducing the
use_permanenttoggle, users can now choose to disable the persistent browser. When disabled, browser instances are created strictly on-demand and are fully managed by thejanitorcleanup logic, ensuring better memory reclamation.List of files changed and why
lifespanstartup sequence to conditionally initialize the browser pool based on theuse_permanentconfig. Added a fallback default ofTrueto ensure zero breaking changes for existing users.use_permanentflag under thecrawler.poolsection to make the feature discoverable and configurable.How Has This Been Tested?
true.use_permanent: falseand verified the following:🚫 Permanent browser instance is disabled by default to save memory.COLD_POOL.janitortask after theidle_ttl_secthreshold is reached.Checklist:
config.yml)