← SOTI Inc. Interview Insights
The core of this was really a cache design problem dressed up as an API question.
Start by clarifying requirements: is this a standalone service or a library? What scale (requests per second, number of IPs)? Then outline the core components: data store for blacklist, API endpoints for CRUD operations, and integration points (e.g., middleware). Finally, discuss trade-offs like consistency vs. availability, and how to handle high throughput.
Pro tip: Emphasize idempotency and caching: blacklist checks are read-heavy, so use an in-memory cache with TTL and ensure that adding/removing IPs is idempotent to avoid race conditions.
Ask about expected scale (QPS, number of IPs), consistency needs, and integration (e.g., as a sidecar, middleware, or external service). This shows you avoid over-engineering.
Choose a storage solution (e.g., Redis for speed, SQL for durability) and define the schema: IP (or CIDR), reason, expiration, created_at. Consider indexing for fast lookups.
Design RESTful endpoints: POST /blacklist (add), DELETE /blacklist/{ip} (remove), GET /blacklist/{ip} (check), GET /blacklist (list). Specify request/response formats, status codes, and idempotency.
Discuss caching (e.g., local cache with invalidation), sharding, and read replicas. For high throughput, consider a bloom filter for quick negative checks, but note false positives.
Cover IP ranges (CIDR), IPv6, expiration/TTL, bulk operations, and consistency vs. availability. Explain how to handle failures (e.g., fallback to allow if cache is down).
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.