Client-Side Semantic Search: Empirical Benchmarking of WebAssembly-Driven HNSW Vector Indexes in Browser Environments versus Centralized Cloud Vector Databases
The widespread adoption of dense vector representations in information retrieval and Retrieval-Augmented Generation (RAG) workflows has established vector similarity search as a critical architectural component in modern software systems. Conventionally, production web applications offload nearest-neighbor vector retrieval to centralized, cloud-hosted vector database clusters (e.g., Pinecone, Milvus, Qdrant). While centralized vector databases provide horizontal scale and dedicated compute resources, they inherently incur wide-area network (WAN) round-trip latency, recurring operational hosting expenditures, and data exposure trade-offs when indexing sensitive client corpora. Recent advancements in web runtime technologies—specifically WebAssembly (Wasm), 128-bit Single Instruction Multiple Data (SIMD) execution, and multi-gigabyte client IndexedDB storage—offer a technically feasible alternative: client-side vector search executed directly within the browser runtime. This paper presents an empirical benchmark comparing a client-side WebAssembly implementation of Hierarchical Navigable Small World (HNSW) vector graphs against production cloud vector databases. Our experimental framework evaluates end-to-end query latency across five simulated network profiles (Gigabit Fiber, 5G, 4G LTE, 3G, and Offline), index construction throughput, V8 virtual machine memory consumption, garbage collection pause frequency, and mobile battery discharge across three embedding dimensions (384-d, 768-d, and 1536-d) from 1,000 to 100,000 vectors. Key Findings:• Under standard cellular network conditions (4G LTE), client-side Wasm search achieves a median query latency of 4.12 ms compared to 86.50 ms for cloud-hosted endpoints (a 21x latency reduction).• Provides deterministic 4.12 ms execution during complete network partition (100% offline availability).• 12-Month Total Cost of Ownership (TCO) evaluation shows a 96% to 99% operational expenditure reduction ($12–$180/yr vs $4,120–$82,400/yr for cloud clusters).• Maintains 98.1% to 99.4% Recall@10 accuracy while strictly preserving on-device client privacy (HIPAA/GDPR compliant with zero cloud data egress). Finally, we formalize an Architectural Decision Framework and the Vector Retrieval Trilemma to guide software engineers in evaluating when client-side vector retrieval is appropriate relative to centralized or hybrid retrieval topologies.
Authors
- Kartik Kothalkar (ORCID: https://orcid.org/0009-0001-7378-5000)
Institutions
- Oldham Council (GB)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-09-21
- DOI
- https://doi.org/10.5281/zenodo.22876751
- Primary Topic
- Cloud Computing and Resource Management
- Type
- article
- Field-Weighted Citation Impact
- 0.00