Repository navigation
Batched crawl crawler (2/2) - #598
Conversation
|
Can you clarify what you mean by "not backward compatible with older servers?" There's only the prod server right now to worry about. |
|
It means the prod server need to have #597 deployed before you can crawl with this |
|
Review of the crawler side. The main concern is a behaviour change, not a bug in the new code. 1. Synced items are re-submitted every round. The old code posted 2. The gate is gone, but nothing says that was intended. 3. One post carries up to 100 terms' worth of documents. Before, it was one post per term. A body that is too large, for example over Django's 4. The description says "not backward compatible with older servers", but the code is compatible. A 597-less server returns 5. Lost logging.
6. Tests. The
7. Small cleanups.
CRAWLER_VERSION is bumped to 1.1.0, which is correct. This PR must not merge before 597 is deployed, if the new-items path is meant to be used. The fallback covers the other case. |
86343c7 to
18ff668
Compare
|
|
also @blueheron786 When you ask for a review from claude please ask claude to comes up with the implementation for the new test, they are annoying to write. |
|
merging this this should close #596 |
|
Re 1, that's actually a good question, it's the current behaviour but may be a bug |
Benchmark: batched vs per-term submission (#597 + #598)The hypothesis holds. For the same crawl, the batched flow uses about 2.4× less server CPU, and the server index ends up with the same content. Prod would likely save more than this local test shows. Setup. I ran a gunicorn server built from this branch (it includes #597) on a 100k-page index seeded with 3,000 real crawl batches. The old crawler (
Why it wins. Each old POST cost the server about 60ms for things that happen once per request: key lookup, device and stats writes, agreements, and the storage upload. With about 26 POSTs a round, that outweighed the 200 cheap Prod should save more, not less:
Found along the way:
Limits of the test: one sync gunicorn worker, a 100k-page index rather than prod's 102M pages, and batches from 2024. None of these is likely to reverse the result, because the cost difference comes from per-request overhead, which doesn't depend on index size. 🤖 Generated with Claude Code |
Re-run with current crawler data (replaces the numbers in my earlier comment)The batch files my first run replayed came from 2024. They held only 2–8 documents each, so each round was far lighter than a current crawler's. I re-ran everything with realistic inputs:
The conclusion holds, with smaller numbers and a different explanation.
What to watch: one batched POST now takes a median of 13s and up to 19s of server time, with about 600 KB up and 1 MB down. That's well inside prod's 120s gunicorn timeout, and total worker time is half what it was. But each crawler now holds one sync worker for 10–20s per round, and that grows with round size. Capping the items per request bounds it. The next lever for scalability: both flows pay the write-time re-ranking cost, and most of it is regex work. 20% of POST time goes to The username finding from my earlier comment still applies. 🤖 Generated with Claude Code |
NOT Backward compatible with older servers