Library / Case Studies

Box Graph: Spontaneous Social Network at Box

By now it's no secret that the amount of content that is being created and shared is increasing exponentially. To help extract value from all of that content, we introduced Box Skills, a framework that brings machine learning innovations to content stored in Box.

By Box engineers · Box · Added 2026-10-12

Open original source

All content belongs to Box engineers / Box. We only link to it and give credit. Report a problem

Learn this case study

About 37 min left. Your work is saved as you go.

What you are about to study

Box explains a real system. You should know the basics: caching, queues and replication.

Ideas you will meet

Distributed Systems
Consensus, time, failure and the fundamentals of scale-out.
Machine Learning Systems
Recommendations, ranking, feature stores and serving models at scale.

What we already know about this

Our own lessons on these ideas. Read them here before you start, so it makes sense.

  • Real-World Systems · 10 minDiagnosing a slow machine: CPU, memory and I/OA calm, repeatable method for finding why a server is slow, with the commands and signals that matter.Read here

    Start with a method, not with commands

    When something is slow, people often run tools at random. A short routine finds the cause faster:

    1. Define the symptom: what is slow, since when, for whom? Latency, throughput or errors?
    2. Look for a change: deployments, configuration, traffic, data growth, a failing dependency.
    3. Check each resource with the USE method: for CPU, memory, disk and network, ask three questions:
      • Utilisation: how busy is it?
      • Saturation: is work waiting in a queue?
      • Errors: is anything failing?
    4. Drill into the suspect with a more detailed tool (profiler, trace).
    5. Fix, then verify that the metric you started with improved.

    Figure SDA-RWS-12-1 · Slow-system investigation flow · © forcsguy.com

    Reading the signals

    CPU

    • top or htop: which processes use CPU? Is time spent in user code, system (kernel) or iowait (waiting for disk)?
    • Load average counts runnable and waiting tasks. Load much higher than the number of cores means queueing, but remember that tasks waiting on I/O also count.
    • A flame graph (from perf or a language profiler) shows which functions consume the time.

    Memory

    • free -m and vmstat: available memory, swap use. Swapping heavily makes everything slow.
    • A process whose resident memory only grows has a leak (or an unbounded cache). Watch memory over time, then take a heap profile.
    • The operating system uses spare memory as a file cache, so "used" memory is not always a problem. Check available.

    Disk (I/O)

    • iostat -x: utilisation, queue length and await (latency per request). High await with a busy disk means storage is the bottleneck.
    • iotop shows which process does the I/O.
    • Full disks and exhausted inodes cause odd failures.

    Network

    • ss -s, netstat, and interface counters: connections in odd states, retransmissions, dropped packets.
    • Check DNS time, connection pool limits and ephemeral port exhaustion.

    Application level

    • Slow queries and lock waits in the database, thread pool or connection pool exhaustion, garbage-collection pauses, and calls to slow dependencies.
    • Distributed traces show where each request spends its time. Logs with a correlation id fill in the detail.

    Figure SDA-RWS-12-2 · Which tool looks at which layer · © forcsguy.com

    A few useful commands

    QuestionTool
    What is using CPU and memory?top, htop, ps aux --sort=-%cpu
    Is the machine swapping or waiting on disk?vmstat 1, iostat -x 1
    What is a process doing?strace -p PID (system calls), lsof -p PID (open files)
    Network statess -tan, ping, traceroute, curl -w timing
    Where is the time in the code?a profiler or perf, then a flame graph

    Real-world reading

    Open this lesson with its quiz and exercise

Go deeper on this

A path through videos, articles, other case studies and code on the same ideas as Box Graph: Spontaneous Social Network at Box.

  1. Warm upGet the vocabulary first.

  2. WatchHow others solve the same problem, on video.

    Videos belong to their creators and play from YouTube. More on YouTube (opens in a new tab)

  3. ReadEngineers explain it in their own words.

  4. See it in another companyThe same ideas, a different system.

  5. Read the codeSee how it looks when it is real.

Keep learning

Loading community…