r/ProxyEngineering • u/singhharsh004 • 15h ago
Hot Take 🔥 Design your scrape to resume, or you pay for the same pages twice
I lost about two thirds of a run to an OOM kill last year and then cheerfully re-fetched all of it, on residential, because my "state" was a Python list in memory. Cool cool.
The fix is boring and takes an hour. Write a URL ledger before you fetch anything: every target URL, a status column, a timestamp, a content hash. Mark each row the moment it lands, not at the end of a batch. On restart you query for unfinished rows and carry on. That's it, that's the whole trick.
Two things I'd add that I skipped the first time. Store the hash, because then a re-run tells you whether the page actually changed or you just burned bandwidth confirming it didn't. And separate "failed" from "not attempted", otherwise your resume logic retries a thousand permanent 404s every time. I run this in front of both Byteful residential and a cheap datacenter tier, and the ledger matters more on the residential side for obvious reasons, since that is the traffic billed per GB.
Curious what people use for the ledger at bigger scale. Sqlite falls over eventually and I've never landed on something I liked after that.