I am developping a new web service and I plan using sessions, however I never find any information on what the maximum size should be.
I plan having ~ 300-400 active sessions at a time with 10,000-20,000 open sessions (24hours session).
I'd like to store in sessions some basic information about the user to avoid SQL query each time a new page is loaded (to lower load and get more speed too). The stored session's array would contain about 300 characters.
Is it the best practice to keep the data in sessions or should I use a different approach ?
What number of concurrent sessions is prefered ? What max size ?
I guess it's mostly related to RAM size..
If you have any URL with such info (about sessions best practices), I'd really appreciate.
█ PutFile.io — Disrupting traditional file hosting. █ Signup Early and enjoy Unlimited space/bandwidth for your files hosting, Forever! █ No Ads. █ No Countdowns.
Sessions are temporary cookies. Info about the session is for the most part stored on the clients computer, then your server reads it off of their computer like a cookie. I would recomend using a cookie that expires after 24 hours as opposed to a session because they are more flexable. The only advantage to a session is that they could be set up to store information even if the client's computer doesn't accept cookies.
Host In Us Web Hosting Services |www.hostinus.com
Premium Enterprise Shared Web Hosting
Less than 80Customers per server!
Try us out! We want to earn your business
thanks, I didn't know the data was stored in 'files' I though it was 'volatile'.
Actually it depends on the implementation. Tomcat keeps the session data in memory, hence they can be considered as temporary. However in PHP they are stored on the file system by default (please see http://www.php.net/manual/en/ref.session.php for more details). By extending the session handler you can introduce custom handling however and store the data in memory, databases or other places (there is a handler for PostgreSQL for example).
Originally Posted by Googled
thanks but this is not true, only the session ID is stored in the cookie, not the data associated with the session.
Exactly, sessions never store any information at the client except for the session id. And even this doesnt need to be stored as cookie.
▌Sitemeer.com - Is your site up?
▌Multi-Location Service Availability Check ● the only with support for HTTPS & IDN