Session data and scalability
We could simply let PHP take care of session data. It does that by writing a serialized version of any data placed into $_SESSION
into a file in a temporary directory. Each session has its own file.
But PHP also allows us to implement our own session data handling mechanism. There are a couple of good reasons for using that facility, and storing the information in the database. One is that we can analyze and manage the data better, and especially limit the overhead of dealing with search engine bots. The other is that by storing session data in the database, we make it feasible for the site to be run across multiple servers. There may well be other issues before that can be achieved, but providing session continuity is an essential requirement if load sharing is to be fully effective. Storing session data in a database is a reliable solution to this issue.
Arguments against storing session data in a database include questions about the overhead involved, constraints...