473,396 Members | 1,599 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Caching data

Hi,
I'm using ASP on Windows 2K. I'm NOT using ASP.Net. I have static data in an
XML file that I would like to cache. Based on my idea explained below, is it
an approach that should scale correctly? Considering that the cache will be
used extensively, will this create a bottleneck?

My idea is:
In the application_OnStart(), I load the xml file and store the xml string
in an application variable:
sub application_OnStart()
...
myXmlDOM.Load("myfile.xml")
Application("myXMLString") = myXmlDOM.xml
' Would have been insteresting to store the parsed xml in the
application
' but it returns an error saying the object can't be stored in
application variable
' because it has appartment threaded behaviors.
' Set Application("myXML") = myXmlDOM doesn't work
...
end sub

Then I create an asp file (cache.asp) that has functions to get information
from this xml string.
function getName(theID)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theID
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

function getID(theName)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theName
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

Thanks for you advise,
David.
Jul 19 '05 #1
5 2774
There is a thread-safe version of the XMLDom object
(Msxml2.FreeThreadedDOMDocument) that you could store in the Application
object. I am not familiar with the performance or concurrency issues
associated with it.
--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com
"David Gagné" <ga*********@sympatico.ca> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Hi,
I'm using ASP on Windows 2K. I'm NOT using ASP.Net. I have static data in an XML file that I would like to cache. Based on my idea explained below, is it an approach that should scale correctly? Considering that the cache will be used extensively, will this create a bottleneck?

My idea is:
In the application_OnStart(), I load the xml file and store the xml string
in an application variable:
sub application_OnStart()
...
myXmlDOM.Load("myfile.xml")
Application("myXMLString") = myXmlDOM.xml
' Would have been insteresting to store the parsed xml in the
application
' but it returns an error saying the object can't be stored in
application variable
' because it has appartment threaded behaviors.
' Set Application("myXML") = myXmlDOM doesn't work
...
end sub

Then I create an asp file (cache.asp) that has functions to get information from this xml string.
function getName(theID)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theID
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

function getID(theName)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theName
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

Thanks for you advise,
David.

Jul 19 '05 #2

"David Gagné" <ga*********@sympatico.ca> wrote in message
news:OA**************@tk2msftngp13.phx.gbl...
Hi,
I'm using ASP on Windows 2K. I'm NOT using ASP.Net. I have static data in an XML file that I would like to cache. Based on my idea explained below, is it an approach that should scale correctly? Considering that the cache will be used extensively, will this create a bottleneck?

My idea is:
In the application_OnStart(), I load the xml file and store the xml string in an application variable:
sub application_OnStart()
...
myXmlDOM.Load("myfile.xml")
Application("myXMLString") = myXmlDOM.xml
' Would have been insteresting to store the parsed xml in the
application
' but it returns an error saying the object can't be stored in
application variable
' because it has appartment threaded behaviors.
' Set Application("myXML") = myXmlDOM doesn't work
...
end sub

Then I create an asp file (cache.asp) that has functions to get information from this xml string.
function getName(theID)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theID
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

function getID(theName)
...

set oDs = Server.CreateObject("MSXML2.DOMDocument")
...
if oDs.loadXML(Application("myXMLString")) then
...
xpath = ... theName
' Get the value using selectSingleNode(xpath)
...
end if
set oDs = nothing
end function

Thanks for you advise,
David.


Use the thread safe version to save the parsed document to an
Application variable:

MSXML2.FreeThreadedDOMDocument.4.0

As for bottlenecks, I imagine that you will actually see quite an
improvement in performance by using a cached document. Let me know how
it turns out.

Notes:
1. In the future, please indicate what version of MSXML you are using.
2. Consider using version specific ProgID's, as version independent
ProgID's have been deprecated
3. Consider using "NewParser":

DOM.setProperty("NewParser",True)

HTH
-Chris Hohmann
Jul 19 '05 #3
David,

I have done the same in the past.
I have found the dom object to be a little sluggish
How large is the xml?.

-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #4
Not very big, let say 10K.
How big when you started having problems?
Where you using MSXML 4.0, the free threaded version and the "NewParser" ?

What do you mean "sluggish"?

Thanks,
David.

"dlbjr" <do******@do.u> wrote in message
news:RWWsb.189$Qy4.14466@typhoon01...
David,

I have done the same in the past.
I have found the dom object to be a little sluggish
How large is the xml?.

-dlbjr

Discerning resolutions for the alms

Jul 19 '05 #5
Yes I use 4
I found under heavy traffic the Dom parsing seem to lag client response.

This may give you an idea.

I store ID and Value data in an Application Level array.
I build a dynamic drop down from the array and set the selected item per
client request.

Much faster than using any XML as Application string.

HTH
-dlbjr

Discerning resolutions for the alms
Jul 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: kevin | last post by:
Could someone explain, Caching. I understand Caching as simply saving a copy of something that is unlikely to change and to which you frequently refer as opposed to retrieving a fresh copy every...
0
by: Martin | last post by:
Hi. I had a very frustrating afternoon and evening but I have got it all under control now so all of a sudden I am in a good mood. I want to share some insights on output caching with you lot. ...
10
by: Jon Maz | last post by:
Hi, My goal is to take the entire html/javascript stream spat out by .aspx pages and save them as simple strings in a database (for caching purposes). I'm not sure how I can get hold of this...
10
by: BillGatesFan | last post by:
I'm trying to understand ASP.NET caching. I set the Page Output directive to VaryByParams= None and the duration = 60. Now whenever users hit my web app they can see each others data. Is there...
0
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the...
4
by: DylanM | last post by:
I've seen a few examples on how to cache data in a WinForms GUI, just after some thought on the best solution. The data I'm trying to cache will be generally be small collections of Business...
5
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated),...
2
by: George1776 | last post by:
All, I've recently upgraded our production ASP.NET/C# application from framework 1.1 to 2.0. Since then I've been plagued by out-of-memory errors and problems with the cache object (which may...
0
by: archana | last post by:
Hi all, Can someone tell me how the caching is implemented. Means how data is stored in output caching and data caching. If i am using output caching will that cache maintain on client side?...
3
by: Gary W. Smith | last post by:
I had a couple questions about data caching. We have a site that gets a huge amount of traffic to a few specific pages that have a lot of data on them (300k hits/hour during peak, about 6-10 data...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.