How Engineers Ran Vector Search on a $5 VPS by Fixing SQLite Memory Leaks
Developers building the NetGlyph Knowledge Protocol (NGP 4.5) set out to run a distributed AI vector search engine on a low-cost virtual machine with just 2GB of RAM and no swap space. Rather than using memory-intensive solutions like pgvector or Pinecone, they opted for SQLite as a lightweight alternative. A critical bug was discovered in an AI agent called Hermes, which was silently opening new database connections to fetch timestamps without ever closing them, causing file descriptor leaks that exhausted system resources after processing around 2,258 documents. The fix involved replacing SQL-based time queries with native Python calls and enforcing proper connection handling using context managers to guarantee descriptor closure. These changes stabilized memory consumption and allowed the system to handle hundreds of transactions per second without triggering out-of-memory crashes.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in