PHP Child / Remembering Who You Are

The web forgets on purpose, and that is a feature

Statelessness sounds like a defect until you consider the alternative.

Each request is treated as though it were the first. The machine holds no memory of you between one page and the next. To a beginner this seems like an obvious flaw, because sites clearly do remember. But the forgetting is deliberate and it is what allows the web to be as large as it is. If every visitor required a machine to hold something in mind continuously, capacity would be consumed by people who are merely reading, and any interruption would lose their place entirely.

Because nothing is held, any machine capable of answering can answer. Requests can be spread across many machines without coordination, machines can be added and removed while people are using the site, and a failure loses at most one reply rather than everybody's progress. This is the quiet reason the design has lasted. Independence is what makes scale and resilience affordable.

The price is that remembering has to be built on top, explicitly, and it is never free. Whenever a site knows something about you across pages, that knowledge is being carried or looked up somewhere. It did not persist by itself. Understanding this makes the behaviour of sign-ins, baskets and preferences far less mysterious, and it explains why those features fail in the particular ways they do.