DB sessions, performances worries...

#1
[eluser]Référencement Google[/eluser]
Hi,

Using the db_session library to store some session data at almost each page view for each users, I am worry about performances when the website will go live and will have 1000 visitors / hour.

Is it possible that the use of native PHP sessions could be better than using DB to store things like the actual page wich is viewing the visitor in real time (the reason for that is to get him back to the point he was viewing before a redirection for exemple).

What do you think ?

#2
[eluser]Unknown[/eluser]
You could store the sessions in a heap-table.

http://dev.mysql.com/doc/refman/5.0/en/m...ngine.html

That should be fast enough.

Andreas

#3
[eluser]alpar[/eluser]
Native sessions use the file system that is faster than the db, but less secure, especially on a shared host, the above solution might be good for you, but here are some alternatives:

You can use native sessions for non sensitive data (lie you mentioned) and keep db session for sensitive data (this will result in 2 session cookies, unless you set your own native session handlers, for php, but you loose some security, having 2 session cookies should be ok)

Also you can add a destructor to the session library if your run php5 to iterate with the database only at the beginning and the end of the lifetime. (if you don't set all session variables at once)

#4
[eluser]Référencement Google[/eluser]
Thank to both of you for your answers.

Your solution Alibi looks great for me, I didn't know about that kind of engine, I will try.
One question about it, as they said in the MySQL documentation, it is very fast, but will the MySQL server not too much overloaded while there will be 1000 visitors logged in at the same time on the website ?

Your solution Alpar looks also good, but seems very complex to script, then I will choose the MySql Heap table engine solution.

#5
[eluser]Akademik[/eluser]
Im thinking that if you are not overusing sessions or not using a P3 as your hosting CPU, 1000 visitors per hour is a joke load-wise.

#6
[eluser]Référencement Google[/eluser]
No, sure not a P3, intel Xeon Dual core 2Go, should be enough I think
Thanks for your answer.

#7
[eluser]Akademik[/eluser]
You could ofc try it out with a simple load tester or something.
Perhaps just make a simple controller using some session stuff which requires DB hits and spam it with requests. See how high requests per second or queries per seconds your app can handle.

#8
[eluser]Référencement Google[/eluser]
ok, I will try it

#9
[eluser]tobben[/eluser]
But when using HEAP/MEMORY table I don't think you can use text datatype.

#10
[eluser]Référencement Google[/eluser]
tobben your are right, this is the only problem with Memory tables.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.