Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hidden Text Box or Sessions Variables 3

Status
Not open for further replies.

GaryC123

Programmer
Sep 10, 2002
1,041
NO
Say on a list of 40 properties each with 50 variables would it be better to place each property in a form tag with 50 hidden fields (the user clicks the property that they want) or everything in one form tag and set 50 session variables for each property? Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
I'm not clear on what you're trying to do, but I'm leaning towards the hidden form fields or maybe a session array. Remember that is this is a large application your session variables can eventually clog up your server RAM. Each user will have hundreds of variables associated with their unique session. What are the variables for? How will you be using them? Cookies may be the best solution, but I'm not sure. Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
this sounds like a resources issue that you will be the only one able to answer with testing to see which method will become the most efficient to use. try populating fake instances with timed loops to find which one will be the way to go before actually going through the process of writing the final results out. _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Already got two instances on the server, with session variables it seems slightly slower but only by a second or two. Was just wondering if either way would more intensive on the server i.e. for the server to create a long list of html or to create the session variables.
The session variables would only last about 15 minutes Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
What kind of data are you storing and how are you using it (ie - what for)? If 2 instances slows the server a second or two, what will 200 instances do? Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
from my exp. session var's always seem to suck a bit of server resources so I try to stay away from a great number of uses with them. _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
sorry just thought I would ask a question to any one willing to answer. What about application variable are they bad for server resources? How do they compare to session or hidden form objects for storing many variables?

Is there a rule of thumb to when to use which when designing a web application? To give maximum speed and make it easier for the developer?

Thanks Angus

http\\http\\
 
sorry just thought I would ask a question to any one willing to answer ?????

what are you sorry about? This is a very good topic and needed knowledge when developing a site that will be utilizing server resources in any way.

on application variables: don't use application variables outside the global.asa. they were intended for that means and should only be used for display purposes. my opinion!
long winded global.asa's can slow load time on the default so think of that when declaring many var's in the global.asa.


resources available to read on session variables

_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
I read somewhere about locking application variable what are the advantages/disadvantages of doing this.
would you recomend alway puting the DB connection string as an Application variable.?

My ASP website i support was setup using session varible for DSN database connection string is this bad?

could you just change this by changing initialy where it is set in in the Global.asa and the rest of the site from
e.g: Session("DSN") to Application("DSN")

Thanks Angus

http\\http\\
 
That reminds me of the three commandments of ASP Programming
(can't remember where I read them but it's true)

1.Always Use "Option Explicit"
2.Never Place an objects in a session variables or application variables
3.Always use a OLEDB connection instead of ODBC

I found it after searching
<quote>
If you have stored an ADO connection object in an application level variable, you know that the variable is maintained till the Web server is shut down (the application ends). However, did you know that the variable is maintained on a specific thread? This is referred to as thread affinity. Any script that tries to access the variable has to either be on the same thread to make the call or must translate the call to the specific thread (a process called marshalling), which is a very expensive call to make. This results in lower performance.

If more than one ASP page is trying to make a call to a specific thread, they are placed in a row, one after the other to wait their turn before they can make the call. They are forced to run in a sequence. This is called serialization. Again, this results in performance degradation as your site serves more and more requests.

IIS is built to operate on multiple threads—a multi-threaded application. By placing objects in application level variables and forcing the Web application to wait for a specific thread to become active and run within it, you are forcing IIS to behave like a single threaded, inefficient application—effectively crippling its power.
</quote>
_________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
>> 2.Never Place an objects in a session variables or
>> application variables

In general that is a great principle. But ther actually can be occasions to &quot;break&quot; that rule, as there are with most rules.

-pete
 
Wow ONPNT! Excellent post regarding the use of appication variables! You get another star! Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
 
thanks mwolf00 [smile] _________________________________________________________
for the best results to your questions: FAQ333-2924
01001111 01101110 01110000 01101110 01110100
onpnt2.gif
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top