php - When Session Arrays are not sufficient anymore -


imagine have huge database (mysql & php) 2 tables have:

important id in table #1  important id in table #2 

logged in people site can record these tables encounter on page of website. stored , added live to:

important_session_array_#1 important_session_array_#2 

on each like, session arrays updated new value first in array. values unique id's: ai integers. (and related other tables in dbase.)

then, on each page load access these 2 session arrays, , matching id's other tables loaded live.

this situation raises several questions:

  • how big or long can these session arrays be? there actual limit?
  • is there knowledge on use on mobile devices , limited session storage on devices?
  • is there better way procedure on this? (i sure there is!)
  • any more insights on welcome

it example, 1 encounter on 20 million records on level. hence, we're looking better ways work huge data amounts these - per user.

any thoughts have on welcome!

the maximum data stored in session array same maximum data php allowed use (memory_limit). note might inconvenient fill allowed memory session data only, leaving no space other variables.

php sessions stored on server, capabilities of client browser irrelevant in regard.

even though may possible allow php have session data of 1 giga byte or more, considered bad practice when abusing session act cache. data in session completly read memory permanent storage (most files) when executing session_start() , deserialized (which requires huge amounts of cpu), , @ end of script (or when executing session_write_close()) whole data again serialized (cpu!) , written permanent storage (i/o). moving 1 gb of data , file storage considerably hamper applications performance.

saving ids of stuff person likes session not best approach this. liking 1 single id 1 insert database. querying ids person has liked 1 select. both powered correct index settings (the user id comes mind), , ever executed if code requires knowledge. eating way less performance storing info in session (with no upper limit of how many ids ever stored).


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -