PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Google

Design a prioritized log manager with eviction

Last updated: Mar 29, 2026

Quick Overview

This question evaluates system design and algorithmic competencies in bounded storage management, specifically prioritized eviction, recency-aware ordering, per-file and global capacity accounting, and choosing data structures that meet stated complexity targets.

  • hard
  • Google
  • System Design
  • Software Engineer

Design a prioritized log manager with eviction

Company: Google

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design a log management component that supports prioritized deletion under capacity constraints. Requirements: ( 1) The total number of stored log records across all files must not exceed total_max. ( 2) addLog(fileId, record, priority, timestamp) must automatically evict old data when limits are exceeded. ( 3) When eviction is required, delete the "least important" logs first according to a well-defined policy that considers priority (higher is more important) and recency (newer is more important). ( 4) Support both per-file limits (optional X per file) and a global limit total_max. ( 5) Provide APIs to add logs, query by file, and observe current capacities. Target complexities: O( 1) or amortized O( 1) to identify a deletion candidate and O(log n) or better per insertion/eviction. Describe your data model, data structures, and trade-offs.

Quick Answer: This question evaluates system design and algorithmic competencies in bounded storage management, specifically prioritized eviction, recency-aware ordering, per-file and global capacity accounting, and choosing data structures that meet stated complexity targets.

Related Interview Questions

  • Design a Security Monitoring Framework - Google (medium)
  • Design an Online Coding Judge Platform - Google (medium)
  • Design Calendar Event Conflict Handling - Google (medium)
  • Design a pub-sub replay system - Google (hard)
  • How to host many domains on one IP? - Google (medium)
Google logo
Google
Aug 1, 2025, 12:00 AM
Software Engineer
Technical Screen
System Design
4
0

Design a Log Store with Priority- and Recency-Aware Eviction

Context

You are designing an in-memory (or on-disk) log storage component. Each inserted log belongs to a file (fileId) and has a priority and a timestamp. Storage is bounded by a global capacity and optional per-file capacities. When capacity is exceeded, the system must automatically evict the "least important" logs first. Importance is defined by priority (higher = more important) and recency (newer = more important).

Requirements

  1. Global capacity: The total number of stored log records across all files must not exceed total_max .
  2. Automatic eviction: addLog(fileId, record, priority, timestamp) must automatically evict when limits are exceeded.
  3. Eviction policy: When eviction is required, delete the least important records first. Importance considers:
    • Priority (higher is more important), and
    • Recency (newer is more important).
  4. Limits: Support both per-file limits (optional limit[fileId] = X ) and a global limit total_max .
  5. APIs and complexity targets:
    • Provide APIs to add logs, query by file, and observe capacities.
    • Target complexities: O(1) (or amortized O(1)) to identify a deletion candidate and O(log n) or better per insertion/eviction.

Deliverable

Describe your data model, data structures, eviction policy, algorithms, and trade-offs that meet the above requirements and complexities.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Google•More Software Engineer•Google Software Engineer•Google System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.