Skip to content
advanced Phase 107 · Root Cause Analysis

Five Whys Technique

45m
1 problems
Topic Progress 0%

Five Whys Overview

What is Five Whys?

Five Whys is a root cause analysis technique:
1. Start with the problem
2. Ask "Why?" to find the cause
3. Ask "Why?" again for that cause
4. Repeat until root cause is found
5. Typically takes 5 iterations

Benefits:
├── Simple and effective
├── No special tools needed
├── Focuses on process, not blame
└── Reveals systemic issues

When to Use

Use Five Whys when:
├── Incident occurs
├── Bug found in production
├── Process failure
├── Customer complaint
├── Performance degradation
└── Security breach

Avoid when:
├── Problem is too complex
├── Multiple root causes
├── Need statistical analysis
└── Human factors involved

Example Structure

Problem: Website is down
├── Why 1: Server crashed
│   └── Why 2: Out of memory
│       └── Why 3: Memory leak in application
│           └── Why 4: New code not tested for memory
│               └── Why 5: No memory testing in CI/CD
│                   └── Root Cause: Missing memory tests
└── Solution: Add memory tests to CI/CD

Five Whys Methodology

Step-by-Step Process

// Step 1: Define the problem
$problem = 'Checkout is failing for 20% of users';

// Step 2: Ask Why?
$why1 = 'Payment gateway is timing out';

// Step 3: Ask Why again?
$why2 = 'Payment API is slow';

// Step 4: Continue asking Why?
$why3 = 'Too many requests to payment API';

// Step 5: Keep going?
$why4 = 'No rate limiting on payment calls';

// Step 6: One more time?
$why5 = 'Rate limiting not implemented in design';

// Root Cause: Rate limiting not designed

Analysis Template

// Five Whys analysis
class FiveWhysAnalysis
{
    public function analyze($problem)
    {
        $analysis = [
            'problem' => $problem,
            'whys' => [],
            'root_cause' => null,
            'solutions' => [],
            'prevention' => []
        ];
        
        $currentProblem = $problem;
        
        for ($i = 1; $i <= 5; $i++) {
            $why = $this->askWhy($currentProblem);
            $analysis['whys'][] = $why;
            $currentProblem = $why['cause'];
            
            if ($this->isRootCause($why['cause'])) {
                $analysis['root_cause'] = $why['cause'];
                break;
            }
        }
        
        $analysis['solutions'] = $this->generateSolutions($analysis['root_cause']);
        $analysis['prevention'] = $this->generatePrevention($analysis['root_cause']);
        
        return $analysis;
    }
}

Common Patterns

Pattern 1: Process Gap
├── Problem: Error not caught
├── Why: No validation
├── Why: Process doesn't require it
├── Why: Process not documented
├── Root: Process gap
└── Fix: Document and enforce process

Pattern 2: Knowledge Gap
├── Problem: Wrong implementation
├── Why: Developer didn't know
├── Why: No training
├── Why: Training not provided
├── Root: Knowledge gap
└── Fix: Training program

Pattern 3: Resource Gap
├── Problem: Task not done
├── Why: No time
├── Why: Understaffed
├── Why: Budget cuts
├── Root: Resource gap
└── Fix: Resource planning

Magento Context Examples

Example 1: Checkout Failure

Problem: Checkout failing for 20% of users

Why 1: Payment gateway timing out
├── Why: Too many simultaneous requests
├── Why: No rate limiting
├── Why: Not designed for high traffic
├── Why: Load testing not done
└── Root Cause: Missing load testing

Solution:
├── Add rate limiting
├── Implement circuit breaker
├── Add load testing to CI/CD
└── Monitor payment gateway

Example 2: Slow Search

Problem: Search taking 5 seconds

Why 1: Elasticsearch queries slow
├── Why: Large index size
├── Why: Too many products indexed
├── Why: Index not optimized
├── Why: No index maintenance
└── Root Cause: Missing index maintenance

Solution:
├── Optimize index
├── Add index maintenance cron
├── Monitor index size
└── Implement index rotation

Example 3: Inventory Mismatch

Problem: Overselling products

Why 1: Stock not reserved during checkout
├── Why: Race condition in inventory
├── Why: No locking mechanism
├── Why: Not designed for concurrency
├── Why: Architecture review missed this
└── Root Cause: Missing concurrency design

Solution:
├── Implement inventory reservations
├── Add database locking
├── Design for concurrency
└── Add architecture review process

Example 4: Email Not Sent

Problem: Order confirmation emails not sent

Why 1: Email queue backed up
├── Why: Email service slow
├── Why: Too many emails
├── Why: No rate limiting on emails
├── Why: Email service not configured for scale
└── Root Cause: Email service not scaled

Solution:
├── Scale email service
├── Add rate limiting
├── Implement email queue monitoring
└── Add email service to capacity planning

Documentation and Follow-up

Document Findings

# Five Whys Analysis: Checkout Failure

## Date: 2025-01-15
## Author: John Doe
## Incident: INC-1234

## Problem Statement
Checkout failing for 20% of users during peak traffic

## Five Whys Analysis

### Why 1: Why is checkout failing?
Payment gateway is timing out

### Why 2: Why is payment gateway timing out?
Too many simultaneous requests

### Why 3: Why are there too many requests?
No rate limiting on payment calls

### Why 4: Why is there no rate limiting?
Not designed for high traffic

### Why 5: Why wasn't it designed for high traffic?
Load testing not done

## Root Cause
Missing load testing in deployment process

## Solutions
1. Add rate limiting to payment calls
2. Implement circuit breaker pattern
3. Add load testing to CI/CD
4. Monitor payment gateway metrics

## Prevention
1. Add load testing to deployment checklist
2. Set up payment gateway monitoring
3. Document rate limiting requirements
4. Review architecture for high traffic

Action Items

// Track action items
class ActionItemTracker
{
    public function createActionItem($analysis)
    {
        $items = [];
        
        foreach ($analysis['solutions'] as $solution) {
            $item = $this->actionItemFactory->create();
            $item->setTitle($solution);
            $item->setAssignee($this->determineAssignee($solution));
            $item->setDueDate($this->calculateDueDate($solution));
            $item->setPriority($this->determinePriority($solution));
            $item->setIncidentId($analysis['incident_id']);
            
            $this->actionItemRepository->save($item);
            $items[] = $item;
        }
        
        return $items;
    }
}

Follow-up Process

// Follow-up on action items
public function followUp($analysisId)
{
    $analysis = $this->analysisRepository->get($analysisId);
    $items = $this->actionItemRepository->getByAnalysis($analysisId);
    
    $completed = 0;
    $pending = 0;
    
    foreach ($items as $item) {
        if ($item->isCompleted()) {
            $completed++;
        } else {
            $pending++;
            
            // Check if overdue
            if ($item->isOverdue()) {
                $this->sendOverdueNotification($item);
            }
        }
    }
    
    // Report status
    $this->reportStatus($analysis, $completed, $pending);
}

Practice Problems

0 / 1 solved
Five Whys Analysis

Perform Five Whys analysis on a Magento checkout failure incident.

Solution
// Analysis:
// Why 1: Payment gateway timeout
// Why 2: Too many requests
// Why 3: No rate limiting
// Why 4: Not designed for traffic
// Why 5: No load testing
// Root: Missing load testing
// Fix: Add load testing to CI/CD

Quiz

1. What is the Five Whys technique?

Question 1 options

2. When should you use Five Whys?

Question 2 options

3. What is the goal of Five Whys?

Question 3 options

4. How many iterations does Five Whys typically take?

Question 4 options

Flashcards

Question

Five Whys purpose?

Answer

Find root cause by asking "Why?" repeatedly

Question

When to use Five Whys?

Answer

Incidents, bugs, process failures, recurring issues

Question

Five Whys goal?

Answer

Find root cause, prevent recurrence, not blame

Question

Typical iterations?

Answer

3-5 iterations to reach root cause

Question

Five Whys output?

Answer

Root cause, solutions, prevention actions

Revision Notes

Key Takeaways

  • 1. Five Whys: Ask "Why?" repeatedly to find root cause
  • 2. Use for: Incidents, bugs, process failures
  • 3. Goal: Find root cause, prevent recurrence
  • 4. Iterations: Typically 3-5
  • 5. Output: Root cause, solutions, prevention

Interview Tips

  • Explain Five Whys methodology
  • Walk through example analysis
  • Discuss documentation best practices
  • Know when to use Five Whys

Cheat Sheet

Five Whys

  • Method: Ask Why repeatedly
  • Use: Incidents, bugs, failures
  • Goal: Root cause, prevent recurrence
  • Iterations: 3-5 typical
  • Output: Root cause, solutions, prevention