Thursday, 3 May 2007
Storing PHP Sessions in a Database |
| |
|
| |
There are many reasons to utilize sessions when creating a web-based application using PHP. Over at Devshed, Alejandro Gervasio presents an article that explains how to move your sessions to a database.
He takes an example of a project of order-taking system for a company. To give the users an informative experience, heavy use of sessions is made to keep information of the customer handy, from page to page. After delivering the site to the customer, the traffic is slow at first but within a few months the site picks up speed and serves millions hits in a day. The web server is dying under the stress, and the company turns to you to figure out how to increase their bandwidth. An analysis of the database shows you that its usage is quite low. It's the actual load on the web server that's causing the issue. The problem seems to be the sheer traffic on your web server. How do you cope?
Alejandro says, a solution for this is adding web servers. By adding additional servers will allow the load to be split among more than one machine, allowing each of them to serve data in an efficient fashion.
Though the above solution solves the immediate problem but it might affect the application. He says, if you are ignorant of writing an application for multi-server distribution, than the sessions will fail if left alone. He explains the reasons broadly in the section—'Why did they fail?'
The rest of the article, he explains under the following sections:
|
| |
|
Read the Post
|
| |
|
|
| |
|
|
| |
|