Saturday 09 February 2008 6:12:29 am
<i>I have already heard from at least two hosting providers that I should move my session storage from db to files (they claimed that was one of the reasons for poor performance). How would you comment on that?</i> I don't have a silver bullet. But quite a few hosting providers would tell you that setting up session storage in the filesystem is prone to security problems (that's the reason why the debian guys, security minded, set up permissions that only allow a root cronjob to.delete them, instead of having php garbage-collect them).
Putting sessions in the database is good if you:
- have multiple front-end servers. Otherwise you risk the client not finding his session when going to page 2 (other solution, of course, is to put session files on shared storage, but if you do nfs in sw via a plain linux box your performance is going to be orders of magnitude worse than using the db, due to poor locking implementation. You should really get a solid nas/san solution then. Or you need no shared storage but a level 7 load balancer in front of your servers using session stickiness, and accept the fact that if one of the servers fails the users that where passing through it would loose their sessions by being rerouted through the other)
- have a db that is not overloaded and can accommodate the requests to handle sessions, in terms of space and cpu - have other php apps running beside yours, and want to keep tight separation
Putting sessions in the fs is good if you:
- have good control over filesystem, process and user permissions - have an overloaded db
Principal Consultant International Business
Member of the Community Project Board
|