feat(browser): concurrent page pool (BROWSER_CONCURRENCY, default 4) + raise mem_limit to 5g #1733
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#1733
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/browser-concurrent-pool"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The tradein-browser camoufox service serialized every fetch through a single
_fetch_lock(one page.goto at a time, ~10s/fetch queued) — the throughput bottleneck for ALL scrapers. This makes it process up to N concurrent fetches via a page pool, N = envBROWSER_CONCURRENCY(default 4, ops-overridable).Design (safety-first — single point of failure for all scraping)
_fetch_lock's two jobs:_launch_lockguards ONLY (re)launch (serialized + idempotent);_fetch_sem = Semaphore(BROWSER_CONCURRENCY)bounds concurrent fetches.browser.new_page(), goto+wait+content, closes infinally. No page sharing. Nav timeout / hydration wait / proxy+geoip kwargs preserved. Response shape identical (BrowserFetcher untouched)._safe_relaunch(recycle + crash recovery) runs under_launch_lockonly when_inflight<=1→ never tears the browser out from under live sibling pages; else deferred (logged). Dead browser → lazy relaunch on next request → 503 if proxy down (existing caller-retry path intact).BROWSER_CONCURRENCYparsed at startup (default 4, clamp≥1).mem_limit 2.5g→5g(N firefox pages; ~6.9G free on VPS) +BROWSER_CONCURRENCY: ${BROWSER_CONCURRENCY:-4}.Test plan
Risks (flagged)
Refs #796