Library / Blogs

SitePoint Engineering Blog

Learn Web Design & Development with SitePoint tutorials, courses and books - HTML5, CSS3, JavaScript, PHP, mobile app development, Responsive Web Design

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

Open original source

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

Learn this article

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

What you are about to study

SitePoint wrote this to explain how they thought about a problem. You should know the basics: caching, queues and replication.

Ideas you will meet

Distributed Systems
Consensus, time, failure and the fundamentals of scale-out.

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 · 9 minWhy SSDs are fast, and block, file and object storageHow flash storage differs from spinning disks, and which kind of storage fits which job.Read here

    Hard disks versus SSDs

    A hard disk drive (HDD) stores data on spinning magnetic platters. To read data the head must move (seek) to the right track and wait for the platter to rotate: about 10 milliseconds per random access. Reading sequentially is much faster, because the head stays put.

    A solid-state drive (SSD) stores data in NAND flash chips. There is nothing to move, so a random read takes about 0.1 milliseconds, roughly 100 times faster.

    An NVMe solid-state drive: flash chips and a controller on a small board, with no moving partsImage: 4300streetcar · CC BY 4.0 · Source · Wikimedia Commons: Western Digital SN850X NVME solid state drive 8TB front side

    Why flash is fast

    • No mechanical delay: reads are electrical.
    • Parallelism: a controller spreads data across many flash chips and channels and reads from several at once.
    • Fast interface: NVMe drives talk over PCIe with many queues, instead of the older SATA interface built for spinning disks.

    How flash works (and its quirks)

    • Flash is organised in pages (the smallest unit you read or write, a few KB) grouped into blocks.
    • You can write a page only if it is empty, and you can only erase a whole block at once.
    • So an update is written to a new place and the old page is marked stale. The controller's flash translation layer (FTL) keeps a map from logical to physical addresses.
    • Later, garbage collection moves live pages and erases blocks to reclaim space. This extra internal writing is write amplification.
    • Cells wear out after a limited number of erase cycles, so the controller spreads writes evenly (wear levelling). Drives are rated for endurance.
    • The TRIM command tells the drive which blocks the operating system no longer uses, so it can clean up in advance.

    Design consequence: SSDs love many small random reads, but heavy random writes and very full drives cost performance and lifetime. Log-structured storage engines, which write sequentially, suit them well.

    Figure SDA-RWS-10-1 · Inside an SSD · © forcsguy.com

    Three kinds of storage service

    BlockFileObject
    What you getA raw volume of fixed-size blocksA shared folder treeA flat bucket of objects found by key
    AccessAttached to one server, which formats itMounted by many servers (NFS, SMB)HTTP API (GET, PUT, DELETE)
    LatencyLowestLowHigher
    ScalePer volumeModeratePractically unlimited
    Edit in placeYesYesNo: replace the whole object
    CostHighestMediumLowest
    Use forDatabases, boot disksShared content, home directoriesImages, video, backups, logs, data lakes

    Figure SDA-RWS-10-2 · Choosing a storage type · © forcsguy.com

    Figure SDA-RWS-10-3 · What each storage type looks like · © forcsguy.com

    Figure SDA-RWS-10-4 · How an object store is built · © forcsguy.com

    How each type is reached

    Block storage is a raw volume owned by one server, attached directly or over a storage network (Fibre Channel, iSCSI); the server formats it or hands it to a database. File storage sits on top of block storage and is shared over file protocols such as NFS and SMB. Object storage is a flat namespace of objects reached through an HTTP API, trading speed for scale, cost and durability.

    Practical guidance

    • Put databases on block storage (SSD-backed for performance).
    • Put user uploads, media and backups in object storage, serve them through a CDN, and keep only the object's key in your database.
    • Use file storage only when software truly needs a shared file system.
    • Object stores give durability through replication or erasure coding (see the Core Concepts course), and offer storage classes: hot, infrequent access and archive, with lower cost and slower access.
    • Always back up. Replication protects against hardware failure, not against deleting the wrong thing.

    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 SitePoint Engineering Blog.

  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…