Some low-level system design interview questions focused on creating specific components in Go to achieve various functionalities
- In-Memory Cache with Expiration
• Question: How would you design an in-memory cache in Go that supports TTL (Time-to-Live) for cached items?
• Follow-up: How would you handle concurrent access to the cache? Provide a sample implementation. - Rate Limiter
• Question: Design a rate limiter in Go that limits the number of requests a user can make to an API within a given time frame.
• Follow-up: How would you handle different rate limits for different users? Provide a sample implementation. - Thread Pool
• Question: Implement a thread pool in Go to manage a fixed number of worker goroutines to process tasks concurrently.
• Follow-up: How would you gracefully shut down the thread pool, ensuring all tasks are completed? - Memory Pool
• Question: Design a memory pool in Go for efficient memory allocation and deallocation. Explain its use cases.
• Follow-up: How would you manage fragmentation within the pool? Provide a sample implementation. - Message Queue
• Question: Design a simple message queue in Go for asynchronous task processing.
• Follow-up: How would you ensure message delivery and handle message retries in case of failures? Provide a sample implementation. - Distributed Lock
• Question: Design a distributed locking mechanism in Go using a central service like Redis.
• Follow-up: How would you handle lock expiration and ensure the lock is released if a process crashes? Provide a sample implementation.