Posted: Mon Mar 29, 2004 1:31 am Post subject: design and efficiency issues (revisited)
Hello,
I just posted this message at PHP forum, but I believe this forum would be more appropriate as to the subject. Please don't suspect me as a forum spammer, it's an hoenst mistake.
My background is unix C++ programming. I started web ( asp :-( ) 6 moth ago.
My NT/IIS/ASP website needs to find a more reliable form of existance if you get what I mean ... the cosen reliable configuration for me is Linux/Apache/PHP.
The need to convert my code from ASP to PHP gave a little hope of coding the right way, when you can use your machines resources and they won't crash or get stuck.
OK - the question :
My application needs session tracking including gathering new data from each new page (input from form, time in page etc). when the user leaves my site, i need to make sure all the set of session data is stored to the DB.
I read a lot about session tracking and all it's possibilities(cookies, URLs, session params etc.). I'm asking efficiency. there are 3 major ways i figure:
*1* store in the $_SESSION all the params I need for the curret session. Is the machine and resources handling in PHP on Linux more stable in the way that I can load 20/30 different parameters on each session ? In ASP the site would crash in a day ... Ofcourse I can build a sessionHandler class and assign it to the session at the begining, would that work ?
*2* Another option is at each page load to save the new gathered data to the DB directly since i can store the session id somewhere . this means establishing connection with DB on each load and saving. I could also save session data on a text (or XML) page and when session ends to dump it to db. problem is calling for resources on EACH page load, good or not ?
*3* what I believe is right, and I did it with my asp code, question is if it's not overshoot: the main HTML page has an inner frame within, thats where the changing content is. I have JS params on the main HTML page(or a handling JS class), and on every reload of the inner frame, i dump the params to the HTML main page JS params. when the session dies, i have on_unload that send the data to the server as inner form data. this way i contact the DB only when the session ends, and still can maintain the data from the session. I can still keep a little general info (like id) on each session using cookies and/or $_SESSION.
So, long question ... but i think it's pretty important ....
there are 3 basic ways to maintain data, which is most efficient in PHP ??? how do resource handling on linux makes the job easier ?
thank you very very much if you got this far in reading .. and thank you even more if you reply :-)
yaniv
Posted: Wed Apr 21, 2004 7:41 pm Post subject: Re: design and efficiency issues (revisited)
From a personal point of view I prefer to store directly in the db...this will of course depend on various factors but most sites will simply not generate the traffic required to slow down the db server...
But in my case, i find it simpler and more efficient and I won't loose data if there is a browser screw up...
Also, JS is not likely to be on in every computer and as more and more exploits take advatange of JS to download virus' and trojans, its likely that more people will turn it off.
Storing the data in sessions is also an option, but it does increase the load on the server, which is what you were trying to avoid.
Given the speed and flexibility of mysql and php, entering right into the db is, imho, the best way...
Posted: Mon Feb 22, 2010 12:51 pm Post subject: Re: design and efficiency issues (revisited)
[quote="yaniv"]Hello,
I just posted this message at PHP forum, but I believe this forum would be more appropriate as to the subject. Please don't suspect me as a forum spammer, it's an hoenst mistake.
My background is unix C++ programming. I started web ( asp :-( ) 6 moth ago.
My NT/IIS/ASP website needs to find a more reliable form of existance if you get what I mean ... the cosen reliable configuration for me is Linux/Apache/PHP.
The need to convert my code from ASP to PHP gave a little hope of coding the right way, when you can use your machines resources and they won't crash or get stuck.
OK - the question :
My application needs session tracking including gathering new data from each new page (input from form, time in page etc). when the user leaves my site, i need to make sure all the set of session data is stored to the DB.
I read a lot about session tracking and all it's possibilities(cookies, URLs, session params etc.). I'm asking efficiency. there are 3 major ways i figure:
*1* store in the $_SESSION all the params I need for the curret session. Is the machine and resources handling in PHP on Linux more stable in the way that I can load 20/30 different parameters on each session ? In ASP the site would crash in a day ... Ofcourse I can build a sessionHandler class and assign it to the session at the begining, would that work ?
*2* Another option is at each page load to save the new gathered data to the DB directly since i can store the session id somewhere . this means establishing connection with DB on each load and saving. I could also save session data on a text (or XML) page and when session ends to dump it to db. problem is calling for resources on EACH page load, good or not ?
*3* what I believe is right, and I did it with my asp code, question is if it's not overshoot: the main HTML page has an inner frame within, thats where the changing content is. I have JS params on the main HTML page(or a handling JS class), and on every reload of the inner frame, i dump the params to the HTML main page JS params. when the session dies, i have on_unload that send the data to the server as inner form data. this way i contact the DB only when the session ends, and still can maintain the data from the session. I can still keep a little general info (like id) on each session using cookies and/or $_SESSION.
So, long question ... but i think it's pretty important ....
there are 3 basic ways to maintain data, which is most efficient in PHP ??? how do resource handling on linux makes the job easier ?
thank you very very much if you got this far in reading .. and thank you even more if you reply :-)
yaniv[/quote]
Thank you for the post.
Hi guys, Im a newbie. Nice to join this forum.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum