Search, Geospatial & Real-Time

Search, Geospatial & Real-Time

Search Autocomplete / Typeahead
Trie data structure, top-k per prefix, Redis sorted sets, batch + real-time data pipeline, and personalization
GeoHash
Lat/lng to string encoding, prefix property, 9-cell proximity search, Redis GEO commands, and limitations at high latitudes
QuadTree
Adaptive 2D spatial partitioning, dynamic subdivision, range queries with pruning, and QuadTree vs GeoHash trade-offs
Uber-Style Location Indexing
High write-rate GPS ingestion, GeoHash cells in Redis sorted sets, stale cleanup, H3 hexagonal grid, and hot cell mitigation
Presence & Online Status
Heartbeat-based detection, Redis TTL auto-expiry, fan-out optimization via scoped pub/sub, flapping prevention, and multi-device presence
Notification Fanout Strategies
Fan-out on write vs read, hybrid approach for celebrities, APNs/FCM push delivery, deduplication with Redis SETNX, and per-user rate limiting
WebSocket at Scale
Stateful connection management, sticky sessions, cross-server routing via Redis Pub/Sub, session registry externalization, and heartbeat with exponential backoff reconnection
MQTT
Lightweight IoT pub/sub protocol, QoS levels (0/1/2), retained messages, Last Will and Testament, persistent sessions, broker clustering, and MQTT vs WebSockets
Payment System Design
Double-entry bookkeeping, idempotency keys for safe retries, outbox pattern for distributed transactions, nightly reconciliation, and PCI scope reduction via tokenization
Distributed Job Scheduling
Redis sorted set delayed queues, atomic poll with Lua scripts, lease-based at-least-once delivery, leader-based distributed cron, and per-tenant fair scheduling
Unique ID Generation
UUID v4 randomness vs B-tree fragmentation, Snowflake 64-bit sortable IDs, ULID timestamp+random, database sequences, and clock skew mitigations