How a 2,592‑Line C File Became the World’s Most Ubiquitous Database
The article recounts how Richard Hipp created SQLite—a tiny, fully embedded 900 KB database written in a single C file—that now powers billions of devices, and how his later Althttpd web server handles hundreds of thousands of requests daily, illustrating his prolific open‑source legacy.
Althttpd – a 2592‑line C web server
Althttpd is a minimalist HTTP/1.0 server implemented in a single C source file of 2 592 lines. The complete source is released under a permissive license and can be cloned from the official repository:
git clone https://github.com/sqlite/althttpd.gitThe server is designed to serve static files, support basic MIME type detection, and run on POSIX‑compatible systems (Linux, macOS, BSD). It does not depend on external libraries; the only required build step is a standard C compiler: gcc -O2 -Wall -o althttpd althttpd.c -lpthread Typical usage: ./althttpd -p 8080 -d /var/www where -p selects the listening port and -d specifies the document root.
Performance figures
As of 2018 the server handled roughly 500 000 HTTP requests per day (≈5–6 req/s).
It delivered about 50 GB of content per day (≈4.6 Mbit/s).
Memory footprint stays below 1 MB when serving typical static assets.
SQLite – the embedded database that inspired Althttpd
SQLite is a self‑contained, server‑less relational database written in C. The original implementation fits in a single 900 KB source file and accesses the database file directly on disk, eliminating the need for a separate database process.
Key technical characteristics:
Embedded: the library is linked directly into the host application.
Cross‑platform: builds on Windows, Linux, macOS, BSD, and many other OSes.
Language bindings: native C API plus wrappers for Tcl, C#, PHP, Java, ODBC, etc.
Performance: direct file I/O and a lock‑free B‑tree engine give higher throughput than many client‑server databases for small‑to‑medium workloads.
SQLite originated from a 1990s defense contract where existing commercial databases (e.g., Informix) were too large for a missile’s onboard computer. Richard Hipp wrote a 900 KB C library that could be embedded in any application, which later became SQLite.
Historical milestones
1999 – First public release of SQLite (≈900 KB source).
2001 – Version 2 released; Motorola adopted SQLite for its mobile phones.
2005 – SQLite source opened under a public‑domain‑compatible license; Hipp received the Google O’Reilly Open Source Award.
2004 – Althttpd was created to serve the SQLite website and has been in production ever since.
Related tools by Richard Hipp
Beyond SQLite and Althttpd, Hipp authored several utilities that follow the same “single‑file, self‑contained” philosophy:
Fossil – a distributed version‑control system with integrated bug tracking and wiki.
CVSTrac – a lightweight bug‑tracking system.
Lemon – a LALR(1) parser generator.
All projects are hosted under the sqlite.org domain and are available on GitHub.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
