How safe is the use of Application varaibles in ASP !!Urgent
Hi All..
I want some expert discussion on the usage of Application Variables in ASP.
i m is using a big database on my web site. Actually in my site we are
generating information 15-20 times in a day and uploading it to the net for
the viewing.. Right now i have a option to use XML or Database to retrive
this information for the view purposes.. But i m expecting a huge number of
hits on my site and i m not sure can my server will be able to handle that
much load of Components to parse data from XML or Database.. (XMLDOM,ADODB).
I feel these components are very resource extecnsive applications. So i want
to avoid the usage of any component to parse my data.
After a lot of thought i came to the conclusion to use Application Varaibles
of ASP to store data.. I feel this will be very fast and will use the server
resources very optimisticly.
Now my doubts are :
1. Can i store huge amount of data in the Application Variables say 50 kb of
data, if we store it in a XML format.
2. is the Application varaibles are safe to store information .. i mean in
anycase information should not be lost or manuplated accidently.
3. What is the Server Resources utilization, in this architecture.
4. At what extend i m right to think usage og Application varaibles in the
place of Database or XML
These are few things i have in my mind and i m sure u people can guide in a
very proper way..
Thanx a lot..
Looking for a quick response...
Neeraj Gargi
Neeraj Gargi
wow-india.com
Re: How safe is the use of Application varaibles in ASP !!Urgent
1. I've never used Application obj to store that amound (50k) of data, but I
would imagine it would be fine.
2. As long as you don't store single threaded objects in there.
Application obj is multithreaded so you can access variables at the
concurrently, but when writing into variables makes sure you lock it. When
locked Application obj blocks access to all variables.
Application variables are kept around until you stop IIS.
3. Don't know
4. No matter what, in memory storage will be faster than DB or file system.
With some more logic you can check time stamp and reload data after certain
time.
I've read an article somewhere (could've been MSDN Mag) that you can also
store XML DOM in Application variable, use FreeThreadedDOMDocument instead
of DOMDocument.
Just my opinion,
Sergey.
"neeraj" <neeraj@wow-india.net> wrote in message
news:3a6bce58@news.devx.com...
> Hi All..
>
> I want some expert discussion on the usage of Application Variables in
ASP.
> i m is using a big database on my web site. Actually in my site we are
> generating information 15-20 times in a day and uploading it to the net
for
> the viewing.. Right now i have a option to use XML or Database to retrive
> this information for the view purposes.. But i m expecting a huge number
of
> hits on my site and i m not sure can my server will be able to handle that
> much load of Components to parse data from XML or Database..
(XMLDOM,ADODB).
> I feel these components are very resource extecnsive applications. So i
want
> to avoid the usage of any component to parse my data.
> After a lot of thought i came to the conclusion to use Application
Varaibles
> of ASP to store data.. I feel this will be very fast and will use the
server
> resources very optimisticly.
> Now my doubts are :
> 1. Can i store huge amount of data in the Application Variables say 50 kb
of
> data, if we store it in a XML format.
> 2. is the Application varaibles are safe to store information .. i mean in
> anycase information should not be lost or manuplated accidently.
> 3. What is the Server Resources utilization, in this architecture.
> 4. At what extend i m right to think usage og Application varaibles in the
> place of Database or XML
>
> These are few things i have in my mind and i m sure u people can guide in
a
> very proper way..
>
> Thanx a lot..
> Looking for a quick response...
>
> Neeraj Gargi
> Neeraj Gargi
> wow-india.com
>
>
Re: How safe is the use of Application varaibles in ASP !!Urgent
Caching information in Application variables is both safe and scalable as
long as you follow these rules:
1. Use the Lock and Unlock methods whenever you change the information.
2. Minimize changes, as the Lock method blocks all other threads from
accessing Application variables until the unlock occurs.
3. Don't store apartment-threaded objects in Application variables.
Free-threaded objects are OK, but avoid storing objects at all unless the
overhead of recreating the object from cached data is higher than the
performance hit of storing the object.
4. If you're going to use a variable multiple times on a page, you're
generally better off copying the value to a local variable.
5. If you store arrays, you must update the Application variable if the page
changes an array value.
Since you're only updating the information a few times a day, consider
caching the pages as HTML files which you can then include in your HTML
template. After all, there's no point in using server resources to reformat
the same information as HTML repeatedly. Using this method, you could avoid
the overhead from Application variables altogether. The logic is:
1. Given the current request, including any URL or form values, does a
cached HTML page exist?
2. If so, is it out of date? If so, recreate the page and include it, if
not, just include it.
Russell Jones
Sr. Web Development Editor
DevX.com
"neeraj" <neeraj@wow-india.net> wrote in message
news:3a6bce58@news.devx.com...
> Hi All..
>
> I want some expert discussion on the usage of Application Variables in
ASP.
> i m is using a big database on my web site. Actually in my site we are
> generating information 15-20 times in a day and uploading it to the net
for
> the viewing.. Right now i have a option to use XML or Database to retrive
> this information for the view purposes.. But i m expecting a huge number
of
> hits on my site and i m not sure can my server will be able to handle that
> much load of Components to parse data from XML or Database..
(XMLDOM,ADODB).
> I feel these components are very resource extecnsive applications. So i
want
> to avoid the usage of any component to parse my data.
> After a lot of thought i came to the conclusion to use Application
Varaibles
> of ASP to store data.. I feel this will be very fast and will use the
server
> resources very optimisticly.
> Now my doubts are :
> 1. Can i store huge amount of data in the Application Variables say 50 kb
of
> data, if we store it in a XML format.
> 2. is the Application varaibles are safe to store information .. i mean in
> anycase information should not be lost or manuplated accidently.
> 3. What is the Server Resources utilization, in this architecture.
> 4. At what extend i m right to think usage og Application varaibles in the
> place of Database or XML
>
> These are few things i have in my mind and i m sure u people can guide in
a
> very proper way..
>
> Thanx a lot..
> Looking for a quick response...
>
> Neeraj Gargi
> Neeraj Gargi
> wow-india.com
>
>
Re: How safe is the use of Application varaibles in ASP !!Urgent
Use of Application variables is safe - as others mentioned, make sure you
use "both" threaded COM objects (not apartment threaded ones), and watch
out for locking issues when data is updated. What I mean by that is, if
an ASP page checks a date and then runs some code and replaces an Application
variable, if that ASP page is hit several times at essentially the same time,
locking and update problems on the Application variable can result.
WebGecko software (the company I work for) sells two products that may be
useful to you, particularly since your site is high traffic and performance
matters. The first is Active Page Generator (APGen) - this is probably the
best choice for updating static, or partly static/partly dynamic pages multiple
times a day. It can run ASP-like scripts from a scheduler, SQL triggers,
ASP pages, etc. to update pages or page fragments when you want. It is easy
to learn to use since you're an ASP developer.
The second product is ASPCache - it is similar to the ASP Application object,
but performs about 20x faster, can store a lot of data, and does item expiration
for you. It also supports page fragment caching, which allows you to include
static page fragments (typically generated by APGen) in dynamic pages. I
suggest downloading the trial and testing its performance compared to your
other options.
Please email me if you'd like a trial version.
Regards,
John Crim
WebGecko Software
http://www.webgecko.com
johnc@webgecko.com
"neeraj" <neeraj@wow-india.net> wrote:
>Hi All..
>
>I want some expert discussion on the usage of Application Variables in ASP.
>i m is using a big database on my web site. Actually in my site we are
>generating information 15-20 times in a day and uploading it to the net
for
>the viewing.. Right now i have a option to use XML or Database to retrive
>this information for the view purposes.. But i m expecting a huge number
of
>hits on my site and i m not sure can my server will be able to handle that
>much load of Components to parse data from XML or Database