Katkat

Design in-memory threshold switcher

AmazonSoftware Engineer · Technical Screen

Last updated

This question evaluates a candidate's ability to design memory-aware control systems, covering skills such as hysteresis-based thresholding, dynamic runtime reconfiguration, thread-safe concurrency, low-overhead metric sampling, event-driven state notifications, and handling multi-process and failure edge cases.

Design an in-memory "switcher" component that toggles between ENABLED and DISABLED states based on runtime memory usage with user-configurable thresholds. Requirements: (

  1. Support separate upper/lower thresholds (hysteresis) to prevent flapping. (
  2. Allow dynamic reconfiguration at runtime without downtime. (
  3. Provide thread-safe reads/writes and low-overhead sampling of memory metrics. (
  4. Expose callbacks or events when state changes. (
  5. Define behavior under memory spikes, metric polling failures, and multi-process or multi-instance deployments. (
  6. Describe data structures, APIs, concurrency model, and monitoring/metrics. (
  7. Discuss testing strategy, performance considerations, and trade-offs of pull vs push metric collection.