Groups | Blog | Home
all groups > inetserver asp general > november 2003 >

inetserver asp general : Caching data


Mark Schupp
11/13/2003 4:03:47 PM
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


[quoted text, click to view]

Chris Hohmann
11/13/2003 5:24:03 PM

[quoted text, click to view]

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

David Gagné
11/13/2003 6:55:23 PM
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.

dlbjr
11/13/2003 8:17:18 PM
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

dlbjr
11/13/2003 9:27:38 PM
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

David Gagné
11/13/2003 9:42:08 PM
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.



[quoted text, click to view]

AddThis Social Bookmark Button