PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Software Engineering Fundamentals/Databricks

Design a multithreaded event logger

Last updated: May 24, 2026

Quick Overview

This question evaluates a candidate's competency in concurrent programming, synchronization primitives, ordering guarantees, and durable logging mechanisms for multithreaded systems.

  • medium
  • Databricks
  • Software Engineering Fundamentals
  • Software Engineer

Design a multithreaded event logger

Company: Databricks

Role: Software Engineer

Category: Software Engineering Fundamentals

Difficulty: medium

Interview Round: Onsite

Design a multithreaded in-memory event logger for a server application. Requirements: - Many worker threads running in the process need to log events concurrently. - Each event contains: - A timestamp (to the millisecond). - A log level (INFO, WARN, ERROR). - A message string. - The logger should: - Provide a method `log(Event e)` that can be safely called from multiple threads. - Store events in memory in the order they were logged (best-effort ordering by timestamp, but explain your choice). - Periodically flush events to disk as an append-only log file. - Support log rotation when a file exceeds a given size limit (e.g., 100 MB). Tasks: 1. Describe the concurrency model and data structures you would use so that `log(Event e)` has low contention and good throughput. 2. Explain how you would ensure that events are not lost in case of a crash (or clarify the guarantees you provide). 3. Describe how the flushing and log rotation mechanism works, including which thread is responsible and how it interacts with the logging threads. 4. Discuss trade-offs between: - Using a global lock vs lock-free or queue-based approaches. - Per-thread buffers vs a global queue. 5. Mention how you would test correctness under concurrency (e.g., ordering, missing logs, duplicates).

Quick Answer: This question evaluates a candidate's competency in concurrent programming, synchronization primitives, ordering guarantees, and durable logging mechanisms for multithreaded systems.

Related Interview Questions

  • Build a Durable Key-Value Cache - Databricks (medium)
  • Design a Cache with Hit Counts - Databricks (hard)
  • Design a multi-threaded synchronous log writer - Databricks (hard)
  • Optimize least-k revenue queries for read/write load - Databricks (medium)
  • Explain storing files to disk with concurrency - Databricks (medium)
Databricks logo
Databricks
Dec 8, 2025, 6:42 PM
Software Engineer
Onsite
Software Engineering Fundamentals
34
0
Loading...

Design a multithreaded in-memory event logger for a server application.

Requirements:

  • Many worker threads running in the process need to log events concurrently.
  • Each event contains:
    • A timestamp (to the millisecond).
    • A log level (INFO, WARN, ERROR).
    • A message string.
  • The logger should:
    • Provide a method log(Event e) that can be safely called from multiple threads.
    • Store events in memory in the order they were logged (best-effort ordering by timestamp, but explain your choice).
    • Periodically flush events to disk as an append-only log file.
    • Support log rotation when a file exceeds a given size limit (e.g., 100 MB).

Tasks:

  1. Describe the concurrency model and data structures you would use so that log(Event e) has low contention and good throughput.
  2. Explain how you would ensure that events are not lost in case of a crash (or clarify the guarantees you provide).
  3. Describe how the flushing and log rotation mechanism works, including which thread is responsible and how it interacts with the logging threads.
  4. Discuss trade-offs between:
    • Using a global lock vs lock-free or queue-based approaches.
    • Per-thread buffers vs a global queue.
  5. Mention how you would test correctness under concurrency (e.g., ordering, missing logs, duplicates).

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Software Engineering Fundamentals•More Databricks•More Software Engineer•Databricks Software Engineer•Databricks Software Engineering Fundamentals•Software Engineer Software Engineering Fundamentals
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.