Architecture and Technical Trade Offs Questions
Centers on system and solution design decisions and the trade offs inherent in architecture choices. Candidates should be able to identify alternatives, clarify constraints such as scale cost and team capability, and articulate trade offs like consistency versus availability, latency versus throughput, simplicity versus extensibility, monolith versus microservices, synchronous versus asynchronous patterns, database selection, caching strategies, and operational complexity. This topic covers methods for quantifying or qualitatively evaluating impacts, prototyping and measuring performance, planning incremental migrations, documenting decisions, and proposing mitigation and monitoring plans to manage risk and maintainability.
Sample Answer
Sample Answer
Sample Answer
Sample Answer
import time
import threading
from collections import defaultdict
class TokenBucket:
def __init__(self, rate, capacity):
"""
rate: tokens per second
capacity: max tokens (burst capacity)
"""
self.rate = float(rate)
self.capacity = float(capacity)
self.tokens = capacity
self.last_ts = time.monotonic()
self.lock = threading.Lock()
def allow(self, tokens=1):
with self.lock:
now = time.monotonic()
# refill
elapsed = now - self.last_ts
self.last_ts = now
self.tokens = min(self.capacity, self.tokens + elapsed * self.rate)
if self.tokens >= tokens:
self.tokens -= tokens
return True
return False
class RateLimiter:
def __init__(self, rate, capacity):
self.rate = rate
self.capacity = capacity
self.buckets = defaultdict(lambda: TokenBucket(rate, capacity))
self.global_lock = threading.Lock() # protects creation race
def allow_request(self, key):
# ensure bucket exists in a thread-safe way
with self.global_lock:
bucket = self.buckets[key]
return bucket.allow(1)Sample Answer
Unlock Full Question Bank
Get access to hundreds of Architecture and Technical Trade Offs interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.