Backend Project Deep Dive: Bottlenecks and Scaling Trade-Offs
Medium · Behavioral & Leadership · Backend Software Engineer · Onsite
Prompt
In an onsite interview for a Backend Software Engineer role at TikTok, walk through a technically demanding backend project from your recent work and explain how its architecture evolved under load. Cover the business and technical problem, your individual ownership, the tightest engineering bottleneck, why you selected your core technology stack, and how the system coped as traffic or data volume expanded. Include at least one serious architectural alternative you evaluated, the benchmark or operational evidence that settled the choice, and what you would re-architect after observing the service in production.
Respect strict confidentiality throughout: omit proprietary internal codenames, client identities, and sensitive business figures. If non-disclosure obligations prevent describing a real workplace system, frame a clearly marked hypothetical backend service whose numbers and failure modes remain internally consistent. Briefly note any upfront clarifying questions you would ask regarding architectural breadth versus implementation depth, priority scale dimensions (throughput, data size, tail latency, uptime, or operational overhead), and safe quantitative granularity.
Scope & Expectations
- Isolate your personal technical contributions—design authorship, critical-path code, benchmarking, and rollout—from broader team responsibilities.
- Tie stack and partitioning choices to concrete workload constraints and comparative evidence rather than generic tool popularity.
- Detail how the system behaved under real growth, including which simplifying premise cracked first and how you mitigated it safely.
- Share rounded, NDA-safe metrics alongside candid operational hindsight on remaining bottlenecks.
Step-by-step walkthrough
Understand what a scaling deep dive tests at TikTok
For a Backend Software Engineer role at TikTok—where viral short videos, live streams, and push campaigns routinely create sudden, heavily skewed traffic spikes—this question tests how you engineer under load rather than just what features you shipped. Interviewers evaluate six signals:
- Personal ownership: Separating what you architected, coded, and operated from what teammates handled.
- One quantified bottleneck: Naming the specific physical or business constraint that drove the design (such as
8xone-minute traffic bursts paired with a60-secondanalytics freshness target). - Evidence-backed stack choices: Explaining why each technology fit your workload and team, alongside a genuine rejected alternative tested with traffic replays, benchmarks, or cost math.
- Real behavior under growth: Naming which assumption broke first in production, how telemetry exposed it, and why your fix preserved correctness.
- Operational hindsight: Identifying a concrete design limitation you would change after running the system in production.
- Confidentiality discipline: Using rounded ratios, anonymized customer descriptions, and public tool names—or explicitly framing a hypothetical system—without leaking proprietary data.
Start with one brief clarifying check ("Would you like me to emphasize the architectural trade-off, my implementation work on the ingestion pipeline, or an equal split?"), then cover both cleanly if the interviewer leaves the choice to you.
Master the scaling building blocks and visualize the bottleneck
Before walking through the story, make sure six backend terms are intuitive: - p99 latency (99th-percentile latency): the response time that 99% of API calls beat, exposing how the slowest 1% of requests behave during traffic spikes (which simple averages hide). - Columnar database (ClickHouse): an analytical database storing each column together on disk for fast dashboard queries; it excels at a few large batch writes (
10,000+rows) and struggles when hit with thousands of tiny synchronous inserts per second. - Partitioned log (Apache Kafka): a durable, append-only message stream divided into parallel lanes (partitions), absorbing sudden write bursts rapidly while downstream workers drain events at a steady batch pace. - Hot partition (key skew): when a single high-volume key (such as one massive customer'sapp_id) hashes30%of all traffic onto one partition and one worker while sibling partitions sit mostly idle. - Consumer lag: how far behind (in unread events or minutes) a worker is relative to the newest event appended to its assigned partition. - Idempotent deduplication: filtering duplicateevent_ids so mobile SDK retries after network timeouts never inflate customer analytics counts.Trace how the architecture evolved from direct database timeouts to buffered batching, and then to salted partition keys when growth exposed key skew:
1. Old path (timeouts at 8x burst): Mobile SDKs ---> Ingestion API ---(tiny inserts)---> ClickHouse (merge overload; p99 = 1.2 s, 0.5% drops) 2. Buffered path (handles burst, vulnerable to single-app skew): Mobile SDKs ---> Go API ---> Kafka [key = app_id] ---> Batch Consumers ---> ClickHouse (p99 = 40 ms) \--> Mega-app puts 30% of traffic on Partition 17 (12-min lag!) 3. Skew-resilient path (salted keys for top apps): Key = app_id + ":" + (hash(device_id) % 16) ---> Spreads mega-app across 16 partitions (Preserves per-device event ordering AND routes same-device SDK retries to the same consumer!)Pace the five story beats in under three minutes
Allocate roughly half your speaking time to the architectural trade-off and what broke under growth—that is where senior engineering judgment shows up:
Beat Share What to cover -------------------------- ------ -------------------------------------------------------------- 1. Context, role & NDA note ~15% Anonymized domain, team size, what you personally designed/built 2. Hardest constraint ~15% 8x 1-minute push bursts + <60 s dashboard SLA + small-insert pain 3. Stack + tested alt ~25% Go + Kafka + ClickHouse vs. 4x DB scaling; 2x peak replay numbers 4. Growth & broken premise ~25% Single-app hot partition (30% load, 12m lag) -> 16-bucket salting 5. Metrics & lessons ~20% Before/after numbers, 5x 18-month growth, dedup & hot-key lessonsSample first-person answer
Below is a confidentiality-safe first-person answer (~365 words, under three minutes spoken) tailored for a TikTok Backend Software Engineer interview, using rounded production figures and anonymized customer references. Swap in your own project—or explicitly introduce it as a hypothetical scenario if your prior work is under strict NDA.
At my previous company—an anonymized mobile analytics provider—client SDKs uploaded batches of in-app events to our ingestion service. As tech lead for a four-engineer rebuild, I authored the design RFC, implemented the Go stream consumer, and led our zero-downtime migration.
Our hardest constraint was extreme burstiness paired with one-minute dashboard freshness. Whenever a large customer sent a push notification to millions of users, traffic jumped to roughly eight times our daily average within sixty seconds. Previously, our API wrote each small SDK batch directly into ClickHouse. Because ClickHouse merges background disk parts and strongly prefers infrequent bulk inserts over thousands of tiny writes, peaks stalled inserts, spiked API p99 latency to 1.2 seconds, triggered SDK retries that double-counted events, and dropped about 0.5% of traffic.
I proposed buffering writes through Apache Kafka. A stateless Go API validates payloads and appends batches to a topic keyed by app ID, while Go consumers flush multi-thousand-row batches into ClickHouse every few seconds after deduplicating recent event IDs in memory. Our alternative was scaling ClickHouse to absorb direct peak writes. Replaying a recorded peak hour at twice its rate settled it: direct writes needed roughly four times our database nodes—sitting mostly idle 23 hours a day—whereas Kafka held p99 accept latency under 50 milliseconds, matched our team's Kafka experience, and gave multi-day replay if a consumer bug shipped.
Under growth, the first assumption to break was that one partition consumer could drain any single customer's burst within sixty seconds. Three months in, one mega-app campaign put roughly 30% of all traffic onto one partition, pushing its consumer twelve minutes behind while others idled. Since queries only needed ordering per user device, I salted large apps' keys using app ID plus
hash(device_id) mod 16and added per-partition lag alerts.Peak p99 accept latency dropped from 1.2 seconds to 40 milliseconds, drops fell below 0.01%, and 95% of events reached dashboards within 30 seconds across fivefold growth over 18 months. Today, I would build automated hot-key splitting from day one and move deduplication into storage, since consumer restarts wiped our in-memory window during deploys.
Prepare for deep-dive technical probes
- "Why didn't sharding by
device_idbreak your in-memory deduplication?" Because every event'sevent_idis generated by a specific(app_id, device_id). When an SDK retries a timed-out batch,app_idanddevice_idstay identical, sohash(device_id) % 16deterministically routes the retry to the exact same Kafka partition and consumer instance. - "Why not enable ClickHouse's built-in asynchronous inserts instead of operating Kafka?" Server-side async inserts coalesce small writes in ClickHouse RAM, easing disk-part pressure, so for a team with no Kafka footprint and tolerant clients it is a great cheap first step. However, it still couples API availability directly to database health during maintenance or outages and offers no multi-day replay log if validation logic has a bug.
- "How did you cut over without losing or double-counting customer events?" Shadow-write incoming batches to Kafka while keeping the legacy path live, compare per-app minute-by-minute row counts in a staging ClickHouse table until discrepancy is understood, shift customer reads gradually behind a feature flag, and keep the fallback switch warm for 48 hours.
- "Why didn't sharding by
Intuition & how it works
Think of handling an 8x mobile event burst like placing multi-lane stadium turnstiles and a subway platform (Apache Kafka) in front of high-capacity express trains (ClickHouse), rather than letting 50,000 fans crowd directly into a freight elevator door that jams whenever people trickle in two at a time. Buffering lets the entry gate accept tickets in 40 milliseconds while workers pack full, efficient train cars—until one superstar entrance suddenly attracts 30% of the entire crowd into Lane 17 (a hot partition), backing that single lane up for twelve minutes while the other lanes sit empty.
The obvious way candidates stumble on this question is by narrating a static architecture diagram with "we" everywhere, justifying tools with slogans ("we picked Kafka because it's fast and scalable"), and claiming the design worked flawlessly forever. Senior backend interviewers know every real system hits a broken assumption as traffic grows; they want to see what you measured before choosing the stack, which assumption cracked first under skew, and how you separated hardware saturation from code inefficiency.
Trace how the numbers, evidence, and scaling fixes connect in one consistent arc:
1. Bottleneck 8x push bursts hit ClickHouse with tiny writes -> p99 = 1.2 s, 0.5% drops + retries
2. Replay evidence 2x peak-hour replay: direct DB writes need 4x nodes (idle 23h/d) vs. Kafka p99 < 50 ms
3. First failure Keying by app_id puts 1 mega-app (30% of load) on 1 partition -> 12-min consumer lag
4. Skew fix Salt heavy apps via app_id + (hash(device_id) % 16) -> preserves per-device order & dedup
5. Production win p99 1.2 s -> 40 ms, drops < 0.01%, 95% visible < 30 s across 5x growth over 18 months
Six backend concepts anchor the walkthrough:
- p99 latency (99th-percentile latency): the response time beaten by 99% of requests, capturing worst-case tail behavior during traffic spikes that average latency hides.
- Columnar database (ClickHouse): an analytics store that groups values by column rather than row on disk; it achieves massive write throughput on infrequent multi-thousand-row batches but stalls on rapid tiny inserts.
- Partitioned log (Apache Kafka): an ordered, durable stream divided into parallel partitions that absorbs sudden write spikes sequentially on disk while consumers drain batches asynchronously.
- Hot partition (key skew): an uneven traffic distribution where one popular partition key funnels an outsized share of load onto a single partition and single worker.
- Consumer lag: the delay (measured in unread messages or seconds) between the newest event written to a partition and the offset currently processed by its consumer.
- Idempotent deduplication: ensuring repeated network retries of the same event_id produce the exact same stored count as a single delivery.
What interviewers look for
- Crisp personal ownership in the first 30 seconds: Stating clearly whether you wrote the design doc, built the producer/consumer, ran the load test, or led the migration.
- A single quantified primary constraint: Anchoring the architecture around concrete numbers (
8x60-second bursts +< 1 minfreshness SLA) instead of a vague wish list. - A fair, tested alternative: Comparing your chosen stack against a credible alternative using production traffic replay, profiling data, or cluster cost arithmetic—plus acknowledging existing team operational familiarity.
- Failure-mode transparency under growth: Explaining which simplifying assumption broke first in production, why initial monitoring caught it late (aggregate lag vs. per-partition lag), and why your key-splitting fix was safe.
- Consistent before-and-after metrics and honest hindsight: Pairing clear latency/drop-rate improvements with a candid critique of remaining weaknesses (such as volatile in-memory deduplication).
- Strict confidentiality hygiene: Communicating hard engineering rigor using rounded multipliers and anonymized domains without exposing employer secrets or customer identities.
Common mistakes
- Giving a guided tour of boxes without ownership or "why": Describing six microservices without isolating a single trade-off you personally drove.
- Treating brand-name tools as self-justifying: Saying "we added Kafka for scale" without naming the exact property required (decoupling small writes into bulk batches + multi-day replay retention).
- Knocking down a straw-man alternative: Comparing your design only against something obviously broken (like writing analytics to a single CSV file) instead of a realistic database-scaling option.
- Telling a story where nothing ever broke post-launch: Leaving yourself empty-handed on follow-up questions about failed assumptions and operational lessons.
- Promising "just add more instances" for the next 10x: Missing stateful bottlenecks—like in-memory deduplication maps or fixed partition counts—that do not scale linearly by adding stateless pods.
- Leaking proprietary names or being hopelessly vague: Either naming confidential client accounts or stripping away every number so the interviewer cannot verify your engineering reasoning.
Follow-up questions
- As production volume climbed, what initial architectural premise broke down first? Our earliest premise was that a single Kafka consumer could drain any individual customer app's burst within sixty seconds, making plain
app_idpartitioning look clean and sufficient. Three months post-launch, one enterprise customer ran a push campaign that concentrated roughly30%of cluster-wide traffic onto a single partition, pushing its consumer twelve minutes behind while sibling consumers sat mostly idle—and our aggregate-lag alert missed it initially because total lag across64partitions still looked modest. Because downstream queries only required strict ordering per user device, we added per-partition lag alerts and salted large apps' keys usingapp_id + hash(device_id) % 16, fanning load across16partitions while preserving per-device order and deterministic retry routing. - What signals and benchmarks told you whether the slowdown stemmed from under-provisioned hardware or suboptimal code? I compared our lagging production consumer against two baselines: first, sibling consumer instances in the same group (which sat below
20%CPU, proving cluster-wide capacity was ample and load distribution was skewed), and second, a minimal benchmark consumer on the identical VM type that simply read raw bytes from Kafka and batch-inserted into ClickHouse to establish the raw hardware ceiling. True hardware saturation shows all workers evenly busy near that ceiling with throughput scaling linearly as partitions and pods increase; a code bottleneck shows one worker pegging CPU far below network or disk limits. CPU profiling (pprof) also revealed our consumer was deserializing every JSON field into structs and re-serializing rows when it only neededevent_id—parsing justevent_idand forwarding validated payloads nearly doubled per-worker throughput. - At 10x your current peak load, which subsystem hits its ceiling first and how would you re-architect it? The per-consumer in-memory deduplication window hits its ceiling first. At tenfold event volume, holding a sliding window of recent
event_idstrings in consumer RAM balloons memory footprint, increases garbage-collection pauses, and still leaks duplicate bursts whenever pods restart during deployments or partition rebalances. I would push deduplication down into storage—using ClickHouse'sReplacingMergeTree(ordered by(app_id, date, event_id)) for background compaction paired with deterministic query-time deduplication where exact funnel counts matter—and replace our static list of salted large apps with dynamic rate-based key salting plus a dual-topic migration playbook for partition expansion.
Follow-up questions
- As production volume climbed, what initial architectural premise broke down first?
- What signals and benchmarks told you whether the slowdown stemmed from under-provisioned hardware or suboptimal code?
- At 10x your current peak load, which subsystem hits its ceiling first and how would you re-architect it?
Similar questions
- Navigating Project Roadblocks with the STAR Framework
- Driving Alignment Across Competing Cross-Team Goals
- High-Volume Data Pipeline Deep Dive
- Thirty-Minute Software Engineering Project Deep Dive
- Diagnosing and Resolving a Live Service Bottleneck
- Engineering Career Goals and Team Collaboration
More TikTok interview questions
- Full-Lifecycle Walkthrough of a Demanding Engineering Initiative Medium
- Cascade Grid Crushing and Width-Bounded Text Splitting Medium
- Text Justification, Wildcard Parentheses, and Grid Shortest Path Medium Pro
- Fix a Partitioned Daily Active Users Query Medium Pro
- Flagship Project Walkthrough and Retrospective Medium Pro
- Thirty-Minute Software Engineering Project Deep Dive Medium Pro
- Presenting Industry Internship and Research ML Work Medium Pro
- Diagnosing and Resolving a Difficult Engineering Problem Medium Pro
- Constant-Time Least Recently Used Cache Medium Pro
- Dimensional Data Warehouse for Marketplace Metrics Hard Pro