Last post Mar 17, 2011 09:21 PM by snagpoonage
Mar 17, 2011 03:58 PM|snagpoonage|LINK
I have 9 administrators on one of my internal sites. There will probably be no more than 3 logged in at any one time. I have the following data for them that I would like to use across their entire session.
So considering the fact that about no more than 3 will be logged in at any time, is this data suitable to store in the Session object for 3 users? Also, does manually added session data need to be manually cleared or will it clear when the Session expires?
Mar 17, 2011 04:12 PM|kedarrkulkarni|LINK
session can be used efficiently for far more data and more users... so, u can definatly use session here..
once one of the admin login, session data can be created for his session... and it will persist till either he log off or session expires after time out (by default 20 minutes)
session is valid for only single user, no other user can see session data of other user. so, if u r looking for this values to be shared for all user who are logged in, then u have to think of using application variable or static variable or some storage
(database, file etc.)
hope this helps...
Mar 17, 2011 04:48 PM|snagpoonage|LINK
Yes this does help thanks keda. I'm glad to hear that Session can be used to hold far more data, because I have read alot about how using Session heavily can impact your applications performance. Our hosting is on shared hosting, so small processor/memory
does this make any impact to your answer or is it still suitable?
And the data is meant to be for single users only so no sharing of the data is nessesary.
Mar 17, 2011 05:28 PM|kedarrkulkarni|LINK
of course use of session should be avoided for perfomance benefit....
but in this case, u r using simple variables (i doubt u want to store heavy/long string in variable "Name") to store in session with very low number of users
session is adviced to avoid to store large data like dataset table etc.
in this scenario it makes more sense to use session variable rather than any other way..
Mar 17, 2011 05:53 PM|snagpoonage|LINK
Mar 17, 2011 06:05 PM|jerryjoseph|LINK
As kedarrkulkarni said this is a perfect scenario to use session. User specific data, less amount of data and very few users.
Our hosting is on shared hosting, so small processor/memory does this make any impact to your answer or is it still suitable?
This is the tricky part. I believe that when you host in a shared hosting other applications hosted in the shared hosting can affect the performance of your application. This is because they share the same memory. If there is an application which heavily
use session then it will affect your application too (even if you don't use session at all). So if you are very much worried about performance then you should go for dedicated hosting.
Mar 17, 2011 09:21 PM|snagpoonage|LINK
Hi thanks Jerry,
Yeah it is frustrating that this will happen, but at the moment we can not afford the dedicated hosting costs but I will definitely be pressuring for it in the future (for a number of other reasons as well).
I guess there are things I can't control like other apps on the server but I thought I should try and at least do my part to ensure I'm not using up the memory. From what I read our shared hosting seems to have what they call VRU or Virtual Resource Units,
I think with this we have allocated amounts of memory / processor so I might not be affected by other users (but I'm not sure).
Anyway thanks for the info!