Bird
Raised Fist0
HLDsystem_design~12 mins

Search and metadata in HLD - Architecture Diagram

Choose your learning style9 modes available
System Overview - Search and metadata

This system allows users to search through large collections of data using keywords and filters based on metadata. It indexes metadata to provide fast and relevant search results while keeping the data updated and consistent.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Search Service <--> Metadata Index
  |
  v
Primary Database
  |
  v
Cache
Components
User
client
Initiates search requests
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Handles client requests, routes them to Search Service
Search Service
service
Processes search queries, interacts with Metadata Index and Database
Metadata Index
search_index
Stores indexed metadata for fast search retrieval
Primary Database
database
Stores original data and metadata
Cache
cache
Stores frequently accessed search results to reduce latency
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayCache
CacheAPI Gateway
API GatewaySearch Service
Search ServiceMetadata Index
Metadata IndexSearch Service
Search ServicePrimary Database
Primary DatabaseSearch Service
Search ServiceCache
Search ServiceAPI Gateway
API GatewayUser
Failure Scenario
Component Fails:Metadata Index
Impact:Search queries become slower because the system must query the database directly without fast index lookups
Mitigation:Fallback to database queries with caching; rebuild or replicate the index asynchronously to restore fast search
Architecture Quiz - 3 Questions
Test your understanding
Which component is responsible for distributing incoming user requests evenly?
ALoad Balancer
BAPI Gateway
CSearch Service
DCache
Design Principle
This design uses a layered approach with caching and indexing to speed up search queries. The Metadata Index provides fast lookup of relevant data, while the cache reduces repeated work. The system gracefully falls back to slower database queries if the index fails, ensuring availability.