SQLite and LiteFS: The Heart of QuickLinker-ZeroRPM ā
Alright, letās get into why SQLite and LiteFS are the real MVPs for QuickLinker-ZeroRPM. This isnāt some textbook theoryāIāve been digging into these tools to see if they can actually pull off 100,000 requests a minute at zero cost. Spoiler: they can, and itās pretty damn cool. Hereās the rundown on what they bring to the table, why they beat out the big dogs like PostgreSQL or MongoDB, and how LiteFS takes it up a notch.
Why SQLite? Itās Lean and Mean ā
I started with SQLite because I wanted something that wouldnāt cost me a dime and could still handle serious traffic. Hereās why itās a no-brainer for this gig:
Zero Bucks, All Guts: SQLite doesnāt need a serverājust a file on the VM. No licensing, no extra VMs, nada. Running it on Oracleās free tier (4 cores, 24 GB RAM) keeps my wallet happy while it churns through URLs.
Speed That Slaps: With some tuningāWrite-Ahead Logging (WAL), synchronous normal mode, memory mappingāitās hitting 80,000 inserts a second (check this out). For 100,000 RPM? Thatās 1,666 requests a second, with 1% writes (16.7 new URLs) and 99% reads (1,650 redirects). Redis eats 99% of those reads, leaving SQLite with like 33 ops a second. Thatās pocket change for it.
Real-World Proof: Bit.ly does 23,000 RPM with ~230 new URLs a minute (Bitly stats). My targetās higher, but the write loadās similarāSQLiteās built for this kind of thing.
Compared to PostgreSQL or MongoDB? PostgreSQLās solid for Phase 1ās 100 req/sāACID-compliant, simple schemaābut itās a hog when you scale up, needing replicas that cost cash. MongoDB? Great for reads, but Redis already owns that, and its 3-node setup for HA is like $15-30 a month. Nope, SQLiteās my ride-or-die here.
LiteFS: Making SQLite Tougher ā
Now, SQLiteās awesome, but itās got a weak spotāitās single-node by nature. If that VM goes down, so do my links. Enter LiteFSāfound this gem while digging around (LiteFS GitHub)āand itās a game-changer for Phase 3. Hereās why Iām stoked about it:
Replication on the Cheap: LiteFS uses a FUSE filesystem to sync SQLite across nodes. No extra VMs neededāit runs on the free tierās spare juice. If one node crashes, another picks up the slack. Thatās 99.9% uptime without breaking my $0 budget.
Keeps It Simple: Itās not a full-on replacementāitās SQLite with a safety net. Writes still hit one primary node, but LiteFS mirrors it live. No crazy setup, just bolt it on and go.
Fits the Plan: At 33 ops a second (16.7 writes, 16.5 reads after caching), replicationās a breeze. Low write load means no bottleneck, and Iāve got 4 cores and 24 GB RAM to play with.
I was worried SQLite might choke under pressure, but LiteFS makes it resilient without me selling my soul to a cloud bill.
How It Stacks Up ā
Vs. PostgreSQL: Postgres is a beast for consistencyāperfect for Phase 1ās small scale. But at 100,000 RPM, youāre begging for read replicas, and thatās $10-20 a month. LiteFS gives me HA for freeāeat that, Postgres.
Vs. MongoDB: Mongoās all about scaling reads, but Redis already kills that job. Plus, its HA needs three nodesā$15-30 a month, and way too heavy for my free VM. SQLite + LiteFS keeps it lean and mean.
Real Talk: Shlinkās been running SQLite in production and loves it (Shlink docs). Add LiteFS, and Iām not just keeping upāIām pushing the envelope.
What I Learned Messing With This ā
SQLiteās No Joke: Everyone says itās for tiny apps, but tune it right and itās a monster. 80,000 ops a second? Thatās nuts for a file-based DB.
LiteFS Is Clutch: Found it late in the game, but itās perfect for keeping things reliable without extra cost. Wish Iād known about it soonerāwouldāve bragged about it in Phase 1.
Cachingās King: Redis doing 99% of the work means SQLite and LiteFS can chill. That 80/20 rule (80% of traffic hitting 20% of URLs) is gold here.
Why Itās Feasible ā
This combo nails itā100,000 RPM, $0 cost, 99.9% uptime. SQLiteās fast enough, LiteFS makes it tough, and the free tierās got the muscle (4 Gbps bandwidth = 2.4M RPM headroom). Iāve got proof from benchmarks, bit.lyās numbers, and Shlinkās success. Itās not just doableāitās a flex.
Whatās Next? ā
- Phase 1: How I kick this off with SQLite.
- Cost Analysis: More on the $0 magic.
- References: Where I got the goods.
Last Updated: March 11, 2025