How milvus-io/milvus-lite works
Project type and purpose
• Milvus Lite is a language-library/CLI tool that embeds a high-performance vector DB engine in Python applications (e.g. Jupyter notebooks, edge devices).
• It provides the same API as Milvus Standalone/Distributed but runs locally via a C++ gRPC server + Python client wrapper.
Main components
a. Python Layer
• MilvusClient API (pymilvus)
• milvus_lite.cmdline (CLI entrypoint for dump & management)
• milvus_lite.server & server_manager (spawns/manages the local C++ server process)
b. IPC/Network
• gRPC (proto files under src/proto define service & messages)
c. C++ Layer (local server process)
• gRPC Server (server.cpp)
• Service Implementation (milvus_service_impl.cpp)
• Proxy Layer (milvus_proxy.cpp) – dispatches calls to local vs remote
• Core Engine (milvus_local.cpp) – implements collection, insert, delete, search, query
• Task Modules (e.g. create_collection_task, insert_task, search_task, hybrid_search_task)
• Parser Module (ANTLR4 grammar + generated PlanParser, visitor)
• Storage Layer (storage/*.cpp) – metadata & vector persistence in local file(s)
• Index Layer (segcore_wrapper + thirdparty knowhere library)
• Utilities (schema_util, string_util, timer, status)
d. External Tools & Build
• CMake + Conan (build system & dependency management)
• Dockerfiles (under scripts) for packaging manylinux wheels or containers
Relationships & data flows
1. Python app calls MilvusClient methods →
2. server_manager.launch() spins up the local C++ server (subprocess) →
3. Python MilvusClient opens gRPC channel to localhost:19530 →
4. gRPC call → ServiceImpl → Proxy → Core Engine (milvus_local) →
a. Core Engine calls Task modules
b. Task modules coordinate Parser (for DSL/Plan), Storage, Index
c. Storage persists data, Index layer builds/queries vector indexes
5. Results bubble back up through gRPC → Python client → user code
Architectural patterns & design principles
• Client-Server pattern (Python gRPC client ↔ C++ gRPC server)
• Layered architecture:
• Presentation layer (Python API & CLI)
• Service layer (gRPC service impl, proxy)
• Domain layer (tasks, parser)
• Persistence layer (storage) & algorithmic layer (vector index)
• Plugin/extensibility points:
• Parser grammar (ANTLR) for adding new DSL commands
• Index abstraction (segcore_wrapper → knowhere backends)
• Storage abstraction
Final checklist
• Clearly label: Python Client, Server Manager, C++ Server (with sub-components), Storage, Index.
• Startup flow (Python → spawn C++ server)
• RPC calls (MilvusClient → gRPC → ServiceImpl → Proxy → Core Engine → …)
• Data flow (insert/search/query → storage/index → response)