Alright, I know how to use sessions and the variables, however looking at the tech docs for php the $_SESSION autoglobal is the ONLY autoglobal that stores its info on the hard disk, and reads it for every request to the array?
This lowers performance time on web serves significantly, especially when looping through the array trying to match certain values...
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-flOriginally posted by forlamp
Alright, I know how to use sessions and the variables, however looking at the tech docs for php the $_SESSION autoglobal is the ONLY autoglobal that stores its info on the hard disk, and reads it for every request to the array?
This lowers performance time on web serves significantly, especially when looping through the array trying to match certain values...
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-fl
Not only is accessing the session variables from a db faster,it's also more secure.I think you'd be hard pressed to find a large difference unless you were serving like hundreds of users concurrently.This site uses vbulletin,I'm not sure how exactly vb does it but the 'whos online' feature works pretty much as follows:
When a user logs in their username/userid and the current timestamp are stored in an 'online' table
Everytime the user loads a new page in the session,the 'online' table is updated with the current time to keep track of when they were last active
to display the users that are online,the 'online' table is looped through
each user's last active time is compared to the current time,if the difference is greater then a predefined timeout the users 'online' row is deleted.
Users who's last active time are less then the maximum idle time are displayed
hth cool, so i had the right idea then huh
well thanks for the confirmation, and the tips on the who's online thing.. that'll come in handy
Does anyone know much about shared memory for server-side stuff and how that works? named pipes? this is alot like c!
-flHi forlamp,
I used to use hard drive, insteal of db. If db host was installed on the other server, Using db perhaps means slower sometimes.
DB server is more secure, not more fast. I am not sure that whether you means those PHP function,:rocker:
<!-- m --><a class="postlink" href="http://www.php.net/manual/en/ref.shmop.php">http://www.php.net/manual/en/ref.shmop.php</a><!-- m -->
thanks,
Martin LauOriginally posted by forlamp
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-fl
the honest truth, you will not notice any difference in speed. write a cookie or write a session or put a session to teh hard drive, eitehr way you have to write to a hard disk at some point. whenyou store it in a db it is actualy writing to the hard drive. so what is the difference? the only thing is the security.
again, you will not see any speed difference on which way you griginally posted by scoutt
the honest truth, you will not notice any difference in speed. write a cookie or write a session or put a session to teh hard drive, eitehr way you have to write to a hard disk at some point. whenyou store it in a db it is actualy writing to the hard drive. so what is the difference? the only thing is the security.
again, you will not see any speed difference on which way you go.
HI scoutt,
Nice to meet you here.
I used to think so too, that 'you will not see any speed difference' between them. Actually, if db-server was installed far from your web-server, speed will been terrible slower. Just like, different host or different country.
We will spend more time on db-server's connect using PHP function mysql_connect or others. I must say, I would rather use xml/txt, than use the db-server (mysql etc.).
Meanwhile, I approve your viewpoint, 'the only thing is the security.'
Thanks,
Marin Lauto some point you have a piint. if the db is not local of course you would see a difference, but not many host will have a db setup in another country or state. most are in house.
also if you get technical the session maybe faster as it is stored into memory, but will have to write to the HDD when it changes.
This lowers performance time on web serves significantly, especially when looping through the array trying to match certain values...
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-flOriginally posted by forlamp
Alright, I know how to use sessions and the variables, however looking at the tech docs for php the $_SESSION autoglobal is the ONLY autoglobal that stores its info on the hard disk, and reads it for every request to the array?
This lowers performance time on web serves significantly, especially when looping through the array trying to match certain values...
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-fl
Not only is accessing the session variables from a db faster,it's also more secure.I think you'd be hard pressed to find a large difference unless you were serving like hundreds of users concurrently.This site uses vbulletin,I'm not sure how exactly vb does it but the 'whos online' feature works pretty much as follows:
When a user logs in their username/userid and the current timestamp are stored in an 'online' table
Everytime the user loads a new page in the session,the 'online' table is updated with the current time to keep track of when they were last active
to display the users that are online,the 'online' table is looped through
each user's last active time is compared to the current time,if the difference is greater then a predefined timeout the users 'online' row is deleted.
Users who's last active time are less then the maximum idle time are displayed
hth cool, so i had the right idea then huh
well thanks for the confirmation, and the tips on the who's online thing.. that'll come in handy
Does anyone know much about shared memory for server-side stuff and how that works? named pipes? this is alot like c!
-flHi forlamp,
I used to use hard drive, insteal of db. If db host was installed on the other server, Using db perhaps means slower sometimes.
DB server is more secure, not more fast. I am not sure that whether you means those PHP function,:rocker:
<!-- m --><a class="postlink" href="http://www.php.net/manual/en/ref.shmop.php">http://www.php.net/manual/en/ref.shmop.php</a><!-- m -->
thanks,
Martin LauOriginally posted by forlamp
So are there any tricks or tips to use to bring the speed of this array back to life? I've heard of people pushing all the variables to a mySql db, then reading them on the next page, I can see that lowers the number of times a particular page must page the hard drive, but is that significantly faster? Are there any other ways?
Also, how does this site keep track of who's logged in and whatnot? that's a neat feature.
-fl
the honest truth, you will not notice any difference in speed. write a cookie or write a session or put a session to teh hard drive, eitehr way you have to write to a hard disk at some point. whenyou store it in a db it is actualy writing to the hard drive. so what is the difference? the only thing is the security.
again, you will not see any speed difference on which way you griginally posted by scoutt
the honest truth, you will not notice any difference in speed. write a cookie or write a session or put a session to teh hard drive, eitehr way you have to write to a hard disk at some point. whenyou store it in a db it is actualy writing to the hard drive. so what is the difference? the only thing is the security.
again, you will not see any speed difference on which way you go.
HI scoutt,
Nice to meet you here.
I used to think so too, that 'you will not see any speed difference' between them. Actually, if db-server was installed far from your web-server, speed will been terrible slower. Just like, different host or different country.
We will spend more time on db-server's connect using PHP function mysql_connect or others. I must say, I would rather use xml/txt, than use the db-server (mysql etc.).
Meanwhile, I approve your viewpoint, 'the only thing is the security.'
Thanks,
Marin Lauto some point you have a piint. if the db is not local of course you would see a difference, but not many host will have a db setup in another country or state. most are in house.
also if you get technical the session maybe faster as it is stored into memory, but will have to write to the HDD when it changes.