gjin@prishtina/writing

A website crawler in Rust that stays under 250 MB at 500,000 pages

How Pounce, a natively compiled SEO crawler and Screaming Frog alternative, keeps memory flat: SQLite as the crawl itself, bounded pipelines, and benchmarks that report their own failures.

Pounce is a technical SEO crawler written in Rust. The tools people use today aren’t natively compiled: Screaming Frog runs on the JVM, FreeCrawl is Electron and Node, LibreCrawl is Python and Flask. A crawler spends its life parsing HTML and holding a large result set, and a runtime taxes both.

The number I care about most isn’t speed. It’s this: memory went from 28 MB to 234 MB across a 50x larger crawl, while the crawl on disk grew to 5.8 GB. Nothing accumulates in proportion to the crawl. Here’s why.

The crawl is a database, from the first row

Most crawlers hold results in memory and save at the end. Pounce writes every page into SQLite from the first row. That one decision does three things:

Every handoff has a size limit

The pipeline (fetch, parse, store) is a chain of channels, and each handoff holds at most 32 items. If the writer is slow, the fetchers wait instead of piling responses up in memory.

A test proves it. It pushes 500,000 URLs through the pipeline with a deliberately slow writer and a 4 KiB body per URL. Without backpressure, that could hold about 2 GiB. Measured growth: 0.36 MiB. Retention depends on channel capacity and how many workers run, not on how many URLs there are.

Finding the quadratic before users did

An early build scaled badly: 500,000 pages took 1,391.5 seconds. After the fix, the same crawl took 142.6 seconds, 9.76 times faster, with memory essentially unchanged. Going from 100,000 to 500,000 pages now costs 7.4 times the time for 5 times the pages, against 21 times before. Not perfectly linear, and the write-up says so.

Benchmarks that report their own failures

The part I’d copy into any project: every number has a file with the command that produced it, the machine, and the date. And runs that failed are published too.

The stack

Tokio for the async runtime, reqwest over rustls with HTTP/2, lol_html for streaming HTML parsing, SQLite bundled through rusqlite so every platform runs the same version, and Tauri 2 for the desktop app. The release build uses thin LTO and a single codegen unit.

The grid stays smooth at that size too: 0.00% dropped frames scrolling 500,000 rows, and exporting all of them to a 149 MB JSON file peaks at 10.2 MB of memory.

All notes