If your developing a new website and want to ensure its scalable sessions can be a sticking point. Since PHP sessions by default are local only you decide to use the session handlers to build your own database driven sessions.
There are a couple problems you may run into with this approach and most database driven examples you may use to base your session code off.
These problems can pretty much be summarized into a single sentence.
Every single page load your database is going to be hit at least 2 times, first to read the session data and then session to rewrite all that data.
You are already working on building a scalable website then I don't need to explain to you what the above means for your performance!
What can you do to fix these issues? A few things can be done.
1. Hash your data when pulled from the DB, if your data hasn't changed don't bother updating
2. Figure out what your margin of error is for how long a session has been inactive, If your hash hasn't changed and that margin of error isn't passed don't update your session timestamps either.
Those 2 things right there can reduce your database overhead for your sessions by around 50%, Looking to shave a little bit more?
3. Use memcache in conjunction with your database, Check memcache first if its there, if it is use memcache, if its not pull from DB and shove into memcache when you DO update your data update memcache at the same time.
Why not use just memcache? What if you run into your memcache memory limit, or your memcache server dies? I prefer to use memcache to help performance but Never "rely" on it for a site to at least run.

