Interview guides · Alibaba Group
Alibaba Group Software Engineer Interview Guide
Alibaba Group Software Engineer interview guide: reported rounds, questions and how candidates describe the process.
The 60-second brief
As a Software Engineer at Alibaba Group, you operate at the core of one of the world’s largest and most technologically sophisticated digital ecosystems. Your work powers hyper-scale systems across e-commerce platforms, global cloud computing, intelligent logistics networks, and AI-native infrastructures. Engineers here do not merely write application code; they build and maintain resilient, ultra-low-latency platforms capable of handling hundreds of thousands of queries per second (QPS) and processing exabytes of data across multi-region distributed networks. The engineering challenges at Alibaba Group are distinguished by their sheer scale and operational complexity.
This guide is scoped to a Software Engineer candidate at Alibaba Group.
Focus areas
- Computer Science Fundamentals
- Resume/Project Deep Dive
- Algorithms (Problem Solving)
The Alibaba Group interview process
Alibaba Group candidates report 4 rounds over 3-5 weeks. The stages below are what candidates describe, not a published process.
Online Assessment
Initial assessment or technical screening call to evaluate candidate's skills.
What to demonstrate
- Initial assessment or technical screening call to evaluate candidate's skills
- Depth in Computer Science Fundamentals
How to prepare
- Answer aloud and timed: Explain the JVM memory model (Heap, Stack, Method Area) and how garbage collection algorithms (such as G1 or ZGC) reclaim memory.
- Answer aloud and timed: How does the Spring Framework handle Bean lifecycles, and what is the difference between
@Component,@Service, and@Repositoryannotations?
Technical Rounds
Series of technical interviews assessing CS knowledge, coding skills, and system design.
What to demonstrate
- Series of technical interviews assessing CS knowledge, coding skills, and system design
- Depth in Computer Science Fundamentals
How to prepare
- Answer aloud and timed: Describe thread synchronization mechanisms in Java, comparing
synchronizedblocks withReentrantLockand concurrent collections injava.util.concurrent. - Answer aloud and timed: How does Redis maintain high performance in distributed environments, and how do you handle cache penetration, avalanche, and breakdown?
Final Interview
Comprehensive interview with a senior engineering manager or department head.
What to demonstrate
- Comprehensive interview with a senior engineering manager or department head
- Depth in Computer Science Fundamentals
How to prepare
- Answer aloud and timed: Explain the internal implementation of HashMap in Java, including how hash collisions are managed and when it converts to a red-black tree.
- Answer aloud and timed: What are the fundamental differences between a process and a thread, and how does the operating system manage context switching?
HRBP Round
Evaluation of cultural fit, work ethic, and long-term career vision by HR.
What to demonstrate
- Evaluation of cultural fit, work ethic, and long-term career vision by HR
- Depth in Computer Science Fundamentals
How to prepare
- Answer aloud and timed: Explain the memory layout of a running process, detailing how the stack, heap, data segment, and code segment interact.
- Answer aloud and timed: How does the TCP/IP stack handle connection establishment, teardown, and congestion control algorithms under high network load?
Where candidates lose points
Master Your Resume Projects
Prepare a crisp 10 to 15-minute presentation of your top projects. Be ready to explain the system architecture on a whiteboard, detail your specific contributions, list performance numbers (such as QPS, latency, and memory footprint), and justify every technical choice.
Be completely honest about your contributions on your resume
Interviewers will drill into specific implementation details to verify your depth of involvement.
Focus on Fundamentals over Frameworks
Do not just memorize API calls or framework annotations. Spend time reviewing how garbage collectors operate, how B+ trees structure indexes, how TCP handles packet loss, and how operating systems handle virtual memory.
Questions & practice
Explain the JVM memory model (Heap, Stack, Method Area) and how garbage collection algorithms (such as G1 or Z
Medium · Java Internals, Concurrency, and Middlew
Explain the JVM memory model (Heap, Stack, Method Area) and how garbage collection algorithms (such as G1 or ZGC) reclaim memory.
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
How does the Spring Framework handle Bean lifecycles, and what is the difference between @Component, `@Servi
Medium · Java Internals, Concurrency, and Middlew
How does the Spring Framework handle Bean lifecycles, and what is the difference between @Component, @Service, and @Repository annotations?
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Describe thread synchronization mechanisms in Java, comparing synchronized blocks with ReentrantLock and c
Medium · Java Internals, Concurrency, and Middlew
Describe thread synchronization mechanisms in Java, comparing synchronized blocks with ReentrantLock and concurrent collections in java.util.concurrent.
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Explain the internal implementation of HashMap in Java, including how hash collisions are managed and when it
Medium · Java Internals, Concurrency, and Middlew
Explain the internal implementation of HashMap in Java, including how hash collisions are managed and when it converts to a red-black tree.
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
What are the fundamental differences between a process and a thread, and how does the operating system manage
Medium · Computer Science Fundamentals & Systems
What are the fundamental differences between a process and a thread, and how does the operating system manage context switching?
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Explain the memory layout of a running process, detailing how the stack, heap, data segment, and code segment
Medium · Computer Science Fundamentals & Systems
Explain the memory layout of a running process, detailing how the stack, heap, data segment, and code segment interact.
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
How does the TCP/IP stack handle connection establishment, teardown, and congestion control algorithms under h
Medium · Computer Science Fundamentals & Systems
How does the TCP/IP stack handle connection establishment, teardown, and congestion control algorithms under high network load?
Approach
- Restate the input: its shape, its size, and what is guaranteed about it.
- Name the brute-force solution and its complexity before improving on it.
- Choose the data structure from the access pattern, not from familiarity.
- State the target complexity and say which constraint rules the naive version out.
Follow-up
- How does this change if the input no longer fits in memory?
- What is the worst case, and how likely is it on real data?
Describe the key concepts of Linux kernel memory management, page allocation, and interrupt handling.
Medium · Computer Science Fundamentals & Systems
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Implement a bug-free insertion algorithm into a doubly linked list while managing edge cases cleanly.
Medium · Data Structures & Algorithms
Approach
- Restate the input: its shape, its size, and what is guaranteed about it.
- Name the brute-force solution and its complexity before improving on it.
- Choose the data structure from the access pattern, not from familiarity.
- State the target complexity and say which constraint rules the naive version out.
Follow-up
- How does this change if the input no longer fits in memory?
- What is the worst case, and how likely is it on real data?
Given a large stream of text data, how do you find the top most frequent words while maintaining optimal t
Medium · Data Structures & Algorithms
Given a large stream of text data, how do you find the top most frequent words while maintaining optimal time and memory complexity?
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Solve a dynamic programming challenge involving resource allocation (a variation of the knapsack/backpack prob
Medium · Data Structures & Algorithms
Solve a dynamic programming challenge involving resource allocation (a variation of the knapsack/backpack problem).
Approach
- Restate the input: its shape, its size, and what is guaranteed about it.
- Name the brute-force solution and its complexity before improving on it.
- Choose the data structure from the access pattern, not from familiarity.
- State the target complexity and say which constraint rules the naive version out.
Follow-up
- How does this change if the input no longer fits in memory?
- What is the worst case, and how likely is it on real data?
Given a set of daily financial transaction logs, extract specific temporal user patterns efficiently using mul
Medium · Data Structures & Algorithms
Given a set of daily financial transaction logs, extract specific temporal user patterns efficiently using multi-pointer or windowing techniques.
Approach
- Say what the runtime actually does before reasoning about the code.
- Name what is shared across threads and what owns each piece of state.
- Identify the window where an invariant is briefly untrue.
- Distinguish a value from a reference to it, and say which one you handed out.
Follow-up
- What happens if two callers reach this at the same time?
- Where could this allocate more than you expect?
Solve array transformation and binary search problems requiring or execution time.
Medium · Data Structures & Algorithms
Approach
- Restate the input: its shape, its size, and what is guaranteed about it.
- Name the brute-force solution and its complexity before improving on it.
- Choose the data structure from the access pattern, not from familiarity.
- State the target complexity and say which constraint rules the naive version out.
Follow-up
- How does this change if the input no longer fits in memory?
- What is the worst case, and how likely is it on real data?
Stop tag and share joins from fanning out a page
Medium · join fan-out · semi-joins · many-to-many
resource_tag is (resource_id, tag_id) with PK (resource_id, tag_id); resource_share is (resource_id, shared_with_user_id, permission). The tagged-and-shared listing inner-joins resource to both, filters tenant_id, tag_id = ANY(3, orders by updated_at DESC and takes 50. Pages come back with fewer than 50 distinct resources and the total in the header is far too high. Explain the row multiplication, rewrite both the page query and the count query so each is correct, and name the index each one needs. PostgreSQL 16.
Approach
- Do the arithmetic against the predicates that are actually there. An inner join emits one row per matching child row, and both joins are filtered: tag_id = ANY(3 admits one user's share rows. So a resource holding three of the requested tags and shared with $3 once yields three rows, not one — the multiplier is its count of matching tags times its share rows for that single user, and that second factor is 1 unless the table admits duplicate (resource_id, shared_with_user_id) pairs. LIMIT 50 then limits rows rather than resources, and COUNT(*) counts pairs — the header is the product, not the population.
- Reject DISTINCT as the fix. It deduplicates after the product has been built, so the planner must materialise and sort the fanned-out set before the LIMIT can apply, and it leaves any SUM or AVG in the same select list wrong.
- Rewrite both filters as semi-joins, keeping resource as the only row source: AND EXISTS (SELECT 1 FROM resource_tag rt WHERE rt.resource_id = r.resource_id AND rt.tag_id = ANY($2)) and the same shape against resource_share. A semi-join stops at the first match per resource and preserves the driving index order, so ORDER BY updated_at DESC, resource_id DESC LIMIT 50 still stops after 50 rows.
- Count with the same predicates and no join at all: SELECT count(*) FROM resource r WHERE r.tenant_id = $1 AND r.status = 'active' AND EXISTS (...) AND EXISTS (...). Nothing multiplies a resource, so the number is the population.
Follow-up
- The filter changes from 'any of these tags' to 'all of these tags'. Rewrite it and state what it costs relative to the ANY form.
- A resource can be shared with the same user twice under different permissions. Does your count change, and should it?
Replace offset paging on the resource feed with keyset
Easy · keyset pagination · composite index · sort order
resource holds resource_id, tenant_id, owner_user_id, title, body_ref, version, status ('draft','active','archived','deleted'), created_at, updated_at, deleted_at, with an index on (tenant_id, status, updated_at DESC, resource_id DESC). The listing endpoint returns active resources for one tenant, newest update first, 50 per page, today with LIMIT 50 OFFSET n. Tenants reach page 400 and rows are created while they read. Write the keyset query, define what the cursor carries and how it is encoded, and say which part of the index each predicate uses. Assume PostgreSQL 16.
Approach
- Name the two failures separately. OFFSET 20000 makes the server produce and discard 20,000 rows, so page cost grows with depth rather than with page size. Independently, any write that changes how many rows sort above the offset moves the window between two fetches, and the direction decides which anomaly you get: an insert lands at the head of updated_at DESC and pushes already-returned rows down past the boundary, so they are returned a second time; a delete above the offset, or a row whose updated_at is bumped above the cursor, pulls rows up and one is never returned at all. Nothing in the response reveals either.
- Write the seek: WHERE tenant_id = 2, $3) ORDER BY updated_at DESC, resource_id DESC LIMIT 50. The row-value comparison is one index range rather than a disjunction, and both columns are NOT NULL, which is what makes that comparison well defined.
- Map each predicate onto the index: tenant_id and status are equality on the leading columns, (updated_at, resource_id) is the range, and the ORDER BY matches the index order so no Sort node appears and the scan stops after 50 rows. The DESC in the definition only matters for mixed directions — a plain ascending btree on the same columns is read backwards for this query.
- Put both sort columns in the cursor and nothing the client can tamper with into another tenant: base64 of (updated_at, resource_id), validated server-side, with tenant_id taken from the principal.
Follow-up
- The client asks for 'jump to page 400'. What do you offer instead, and what does the honest version cost?
- Sort order becomes user-selectable across four columns. How many indexes is that, and which would you refuse to add?
How do non-blocking I/O (NIO) and event-driven architectures (like Netty) differ from traditional blocking I/O
Medium · Computer Science Fundamentals & Systems
How do non-blocking I/O (NIO) and event-driven architectures (like Netty) differ from traditional blocking I/O models?
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
How would you design a high-concurrency architecture capable of supporting 100,000+ QPS during peak traffic bu
Medium · Distributed Systems & High-Concurrency A
How would you design a high-concurrency architecture capable of supporting 100,000+ QPS during peak traffic bursts?
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
Explain the consensus mechanism of the Raft or Paxos protocol and how it guarantees consistency across distrib
Medium · Distributed Systems & High-Concurrency A
Explain the consensus mechanism of the Raft or Paxos protocol and how it guarantees consistency across distributed nodes.
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
How do B+ Trees structure data in MySQL InnoDB, and how do index lookups operate for composite indexes?
Medium · Distributed Systems & High-Concurrency A
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
Describe strategies for database sharding, read-write splitting, and maintaining data consistency across micro
Medium · Distributed Systems & High-Concurrency A
Describe strategies for database sharding, read-write splitting, and maintaining data consistency across microservices.
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
How do you design an effective load balancing mechanism across multi-region cloud deployments?
Medium · Distributed Systems & High-Concurrency A
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
Walk through your most complex architectural project, highlighting the technical tradeoffs, failure modes, and
Medium · Project Experience & Technical Scenarios
Walk through your most complex architectural project, highlighting the technical tradeoffs, failure modes, and performance optimizations you implemented.
Approach
- Fix the scope first: who calls this, how often, and what they do when it fails.
- Name the read and write paths separately; they rarely have the same bottleneck.
- Choose a partition key and say what query it makes expensive.
- State the consistency you need, and where you are willing to be stale.
Follow-up
- What breaks first when traffic grows ten times?
- How does this behave when that dependency is down for an hour?
Describe an instance where a production system failed or experienced an outbreak under high traffic, and expla
Medium · Project Experience & Technical Scenarios
Describe an instance where a production system failed or experienced an outbreak under high traffic, and explain how you diagnosed and resolved the issue.
Approach
- Clarify what is being asked and what a complete answer contains.
- State your assumptions explicitly before working the problem.
- Say what you would check first and why it is the highest-information step.
- Work from the requirement backwards to the design.
Follow-up
- What assumption would you test first?
- How would you know your answer was wrong?
Describe a scenario where you had to evaluate and choose between a relational database (MySQL) and a NoSQL sol
Medium · Project Experience & Technical Scenarios
Describe a scenario where you had to evaluate and choose between a relational database (MySQL) and a NoSQL solution for a high-volume workload.
Approach
- Clarify what is being asked and what a complete answer contains.
- State your assumptions explicitly before working the problem.
- Say what you would check first and why it is the highest-information step.
- Work from the requirement backwards to the design.
Follow-up
- What assumption would you test first?
- How would you know your answer was wrong?
Every query on one table stalls for forty seconds mid-deploy
Medium · lock contention · ddl · migrations
During a release on PostgreSQL, every query touching resource times out for about 40 seconds and then recovers with no intervention. The release ran one migration, ALTER TABLE resource ADD COLUMN archived_reason TEXT, and the migration log shows it completing in 6 ms. Unrelated tables showed no change in error rate. Explain how a 6 ms statement caused a 40-second stall, give the ordered checks you would run on a live system to confirm it, and give the migration procedure that prevents a repeat.
Approach
- Separate the statement's duration from the lock's duration. ADD COLUMN with no default is a catalogue-only change and genuinely runs in milliseconds, but it requires ACCESS EXCLUSIVE, and it cannot acquire that until every transaction already touching the table has finished.
- Account for the queueing, which is the part that surprises people. A lock request that is waiting blocks later requests for conflicting modes behind it rather than letting them overtake, so one long-open transaction holds the DDL and the DDL holds all the traffic. The stall length is set by the longest open transaction, not by the size of the change.
- Confirm on a live system in this order: pg_stat_activity for that table ordered by xact_start, looking for the oldest transaction and specifically for state = idle in transaction; then pg_locks where granted = false to find the waiter; then join them on pid to name blocker and blocked. pg_blocking_pids() does that join for you and is the fastest single call.
- Prevent rather than merely time it better. Set lock_timeout to a second or two on the migration session so the DDL abandons the queue after a bounded wait and is retried, instead of holding it for as long as the oldest transaction lives. Be exact about what that buys: queries arriving during the wait still queue behind the pending ACCESS EXCLUSIVE request, so each attempt costs them up to one lock_timeout of added latency. The outage goes from 40 seconds to about one second per attempt, not to zero. Also run migrations away from deploy-time peaks, and put a statement timeout and an idle-in-transaction timeout on the analytics role that opens the long transactions.
Follow-up
- The same release also wants NOT NULL on that column. What is the sequence that gets there without a long lock?
- Your lock_timeout retry fails ten times in a row because the analytics transaction is always open. What do you change?
Suggested practice checklist
Built from the rounds and topics Alibaba Group candidates report.
Day 1 — Map the Alibaba Group loop
- Write out the reported sequence: Online Assessment, Technical Rounds, Final Interview, HRBP Round.
- For each round, write one sentence on what it is judging, from the description above, and mark the one you are least ready for.
Deliverable: A one-page map of the 4 reported rounds, with the weakest marked.
Day 2 — Work Computer Science Fundamentals
- Spend the session on Computer Science Fundamentals, which Alibaba Group candidates report being tested on.
- Write one worked example in Computer Science Fundamentals and time yourself on it.
Deliverable: One timed worked example in Computer Science Fundamentals.
Day 3 — Work Resume/Project Deep Dive
- Spend the session on Resume/Project Deep Dive, which Alibaba Group candidates report being tested on.
- Write one worked example in Resume/Project Deep Dive and time yourself on it.
Deliverable: One timed worked example in Resume/Project Deep Dive.
Day 4 — Work Algorithms (Problem Solving)
- Spend the session on Algorithms (Problem Solving), which Alibaba Group candidates report being tested on.
- Write one worked example in Algorithms (Problem Solving) and time yourself on it.
Deliverable: One timed worked example in Algorithms (Problem Solving).
Day 5 — Answer out loud: Java Internals, Concurrency, and Middleware
- Answer aloud, timed: Explain the JVM memory model (Heap, Stack, Method Area) and how garbage collection algorithms (such as G1 or ZGC) reclaim memory.
- Answer aloud, timed: How does the Spring Framework handle Bean lifecycles, and what is the difference between
@Component,@Service, and@Repositoryannotations?
Deliverable: Spoken answers to 2 reported Java Internals, Concurrency, and Middleware question(s), under time.
Day 6 — Answer out loud: Computer Science Fundamentals & Systems
- Answer aloud, timed: What are the fundamental differences between a process and a thread, and how does the operating system manage context switching?
- Answer aloud, timed: Explain the memory layout of a running process, detailing how the stack, heap, data segment, and code segment interact.
Deliverable: Spoken answers to 2 reported Computer Science Fundamentals & Systems question(s), under time.
Day 7 — Answer out loud: Distributed Systems & High-Concurrency Architecture
- Answer aloud, timed: How would you design a high-concurrency architecture capable of supporting 100,000+ QPS during peak traffic bursts?
- Answer aloud, timed: Explain the consensus mechanism of the Raft or Paxos protocol and how it guarantees consistency across distributed nodes.
Deliverable: Spoken answers to 2 reported Distributed Systems & High-Concurrency Architecture question(s), under time.
Behavioural preparation
Behavioural rounds judge the decision you made and what it cost.
How does Redis maintain high performance in distributed environments, and how do you handle cache penetration,
Medium · Java Internals, Concurrency, and Middlew
How does Redis maintain high performance in distributed environments, and how do you handle cache penetration, avalanche, and breakdown?
Approach
- Pick a story where you made the decision, not one where you watched it.
- State the situation in two sentences and spend the rest on the reasoning.
- Give the blast radius: what could have broken, and what you measured.
- Name the disagreement and how you resolved it with evidence.
Follow-up
- What would you do differently if you ran that again?
- How did you know your change caused the improvement?
How do you conduct code reviews to enforce code quality, security standards, and architectural alignment?
Medium · Project Experience & Technical Scenarios
Approach
- Pick a story where you made the decision, not one where you watched it.
- State the situation in two sentences and spend the rest on the reasoning.
- Give the blast radius: what could have broken, and what you measured.
- Name the disagreement and how you resolved it with evidence.
Follow-up
- What would you do differently if you ran that again?
- How did you know your change caused the improvement?
Unblock an engineer without taking the keyboard
Easy · mentoring · leases · at-least-once
A teammate has spent two days on a job handler that occasionally writes duplicate rows. They are certain the queue is delivering twice by mistake. You suspect a lease expiring under a slow handler, so the job is running concurrently with itself. Describe how you have unblocked someone in this position: what you asked before offering a hypothesis, what you showed them rather than told them, and what you left them owning. Then say what you would do if their theory turned out to be the right one.
Approach
- Ask before diagnosing, and ask for things answerable from data they already have: the attempt count on the job rows that produced duplicates, the handler's observed duration against its lease expiry, and whether the duplicate rows share a natural key that a unique constraint could have caught.
- Teach the shape rather than the answer. A lease cannot distinguish a dead worker from a slow one, so a handler that outruns its lease is running twice by design, and deploys deliver the other half by killing handlers mid-run on every rollout. Both of their candidate theories produce identical duplicate rows, which is why the evidence has to come from timings rather than from argument.
- Hand over a checklist they execute: a natural key on every write the handler performs so the second copy collides rather than appends, the record of intent written before any external effect, a lease heartbeat while running, and the metric that shows it working.
- Keep ownership with them deliberately. Pair on the first write, then step back; if you finish it yourself you have closed one ticket and left the same person stuck on the next redelivery.
Follow-up
- How would you distinguish a genuine double-delivery from a lease expiry using only the data already stored?
- Their handler calls an external endpoint before recording that it did. What do you tell them to change first?