jonniejoejonson Posted June 12, 2009 Share Posted June 12, 2009 On a site like facebook, where they must make tonnes of sql statments on each page.. do you think that they for example check to see if you are friends with a user on each page.. or do they do it just once and store the result in a session... obviously it makes sense to store it in a session.. however it is easier to just do the request 'see if they are friends' on each page rather than having to check if sessions exists.. and if the session is for that friend... etc. Quote Link to comment https://forums.phpfreaks.com/topic/161949-to-session-or-not-to-session/ Share on other sites More sharing options...
waynew Posted June 12, 2009 Share Posted June 12, 2009 I would imagine that a site as big as Facebook would be using sessions that are stored inside a database, and not on the filesystem. I've done this before and found that it's not that big a performance issue, providing you use proper indexing. <?php if($logged_in){ $are_friends = $user->are_friends($_GET['uid'],$_SESSION['user_id']); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/161949-to-session-or-not-to-session/#findComment-854632 Share on other sites More sharing options...
Daniel0 Posted June 12, 2009 Share Posted June 12, 2009 I would imagine that a site as big as Facebook would be using sessions that are stored inside a database, and not on the filesystem. I'm pretty sure they would be using something like memcached. You should be fine storing the session data in a database. The forums a main site here do that actually. Quote Link to comment https://forums.phpfreaks.com/topic/161949-to-session-or-not-to-session/#findComment-854641 Share on other sites More sharing options...
waynew Posted June 12, 2009 Share Posted June 12, 2009 Man. I can't even imagine the extent of the performance issues that Facebook runs into daily. Their source was leaked a while ago. Server error or misconfiguration dumped all the code on the login page. Although it didn't reveal the inner workings, it did look as if they were using Smarty - or some sort of custom template system. Quote Link to comment https://forums.phpfreaks.com/topic/161949-to-session-or-not-to-session/#findComment-854648 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.