Thuta Learning
AdvancedDevOps & Toolsbeginner

Production Data and Storage

What you'll walk away with

  • Explain the core ideas behind Production Data and Storage
  • Read the diagram and trace how a request or data flows through the architecture
  • Explain what this means for your own project's decisions

Build the mental model

Every production app has three very different kinds of data, and treating them the same is one of the most common ways apps break after launch.

  • Structured data (users, orders, comments) belongs in a database — transactions, indexes, consistent queries.
  • Files (images, videos, PDFs, reports) belong in object storage — built for large binary blobs served over HTTP.
  • Object storage is not a database, and despite appearances, it is not a folder on your server either.

Ephemeral disk eats uploads

A file saved to a production server's local disk — an uploaded avatar, a generated PDF — can silently disappear the moment the platform redeploys, restarts the container, or moves the app to a new machine. On many platforms this happens automatically on every git push.

A production database connection also carries higher stakes than a local one: real credentials, real customer data, network rules, and backup schedules all matter now.

Decide before writing upload code: database record, object storage file, or genuinely disposable data. Getting this wrong rarely shows up in development — it shows up in production, usually as a support ticket.

Object Storage
A system built to store large binary files (images, videos, backups) cheaply and serve them over HTTP, indexed by key rather than by folder path.
Ephemeral Filesystem
Local disk storage that can be wiped when a container restarts, redeploys, or moves to a new machine.
Persistent Storage
Storage that lives outside the app's own container and survives restarts and redeploys, such as a managed database or object storage bucket.
text
PRODUCTION DATA PATHS
---------------------
PRODUCTION DATA PATHS
----------------------

           [ APP SERVER ]
             |        |
      writes |        | writes
             v        v
      [DATABASE]  [OBJECT STORAGE]
      rows/tables   files/images/videos
      (structured)  (blobs)


  LOCAL DISK (container)      MANAGED STORAGE
  -----------------------     -----------------------
  EPHEMERAL                   PERSISTENT
  wiped on redeploy/restart   survives redeploy/restart

Connect it to a real scenario

A tiny classifier makes the decision concrete: given a piece of data, decide which of three destinations it belongs to.

Data kindWhere it belongs
image / video / document / backupobject storage
user-profile / order / commentdatabase
cache-value / session-tokenephemeral (ok to lose)

Ask: would losing this on the next deploy be a disaster, an inconvenience, or a non-event? That answer almost always resolves the ambiguity.

Ephemeral disk eats uploads

Files saved to a platform's local/ephemeral disk can vanish on the next deploy — a genuinely common, costly beginner mistake.

Try the working example

javascript
function classifyStorage(type) {
  const objectStorageTypes = ["image", "video", "document", "backup"];
  const databaseTypes = ["user-profile", "order", "comment"];
  const ephemeralTypes = ["cache-value", "session-token"];

  if (objectStorageTypes.includes(type)) return "object-storage";
  if (databaseTypes.includes(type)) return "database";
  if (ephemeralTypes.includes(type)) return "ephemeral (ok to lose)";
  return "unknown";
}

const items = [
  { type: "image", label: "user avatar upload" },
  { type: "user-profile", label: "username + email row" },
  { type: "cache-value", label: "rate-limit counter" },
  { type: "backup", label: "nightly database dump" },
];

for (const item of items) {
  console.log(`${item.label.padEnd(28)} -> ${classifyStorage(item.type)}`);
}
You should see
user avatar upload           -> object-storage
username + email row         -> database
rate-limit counter           -> ephemeral (ok to lose)
nightly database dump        -> object-storage

5-minute try-it

Extend classifyStorage with two more types: 'export-csv' (a generated report a user downloads once) and 'auth-session' (a logged-in user's session state). Decide, and justify in a comment, which bucket each belongs to.

One important caution

Saving user uploads straight to the app server's local disk and discovering only after a redeploy that they are gone.

Treating a 'temporary' cache value as safe to lose, then quietly building real features that depend on it never disappearing.

MDN — HTTP and file uploadsCloud & Deployment

Easy traps

  • Saving user uploads straight to the app server's local disk and discovering only after a redeploy that they are gone.
  • Treating a 'temporary' cache value as safe to lose, then quietly building real features that depend on it never disappearing.
  • Never assume that working on localhost means it will work in production -- environment, network, database, and security differences can all bite.

Exercise

Extend classifyStorage with two more types: 'export-csv' (a generated report a user downloads once) and 'auth-session' (a logged-in user's session state). Decide, and justify in a comment, which bucket each belongs to.

You'll know it worked when: user avatar upload -> object-storage username + email row -> database rate-limit counter -> ephemeral (ok to lose) nightly database dump -> object-storage