XML Files

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

I am trying to figure out what "rule of thumb" I should be using to figure
out if I must store/retrieve my information from a database or an xml file.
It would appear that web hosting companies will charge more for utilizing
MS SQL server and frankly I just don't feel that the cost are warranted.
There will be no database updates - is is view only info - but how big can
the XML file be before you would say you would not use an XML file for
accessing this data? I could store the information in cache and read it
from cache? Could I also just read the porition of the XML file which is
necessary to satisfy the requested page? At what threshold of traffic
would I say this is not viable?

Should I be concerned about how much memory I will be getting from my web
hosting company?

Thanks in advance for your assistance!!!!!!!!!!!!!
 
Jim Heavey said:
I am trying to figure out what "rule of thumb" I should be using to figure
out if I must store/retrieve my information from a database or an xml file.
It would appear that web hosting companies will charge more for utilizing
MS SQL server and frankly I just don't feel that the cost are warranted.
There will be no database updates - is is view only info - but how big can
the XML file be before you would say you would not use an XML file for
accessing this data? I could store the information in cache and read it
from cache? Could I also just read the porition of the XML file which is
necessary to satisfy the requested page? At what threshold of traffic
would I say this is not viable?

Should I be concerned about how much memory I will be getting from my web
hosting company?

Thanks in advance for your assistance!!!!!!!!!!!!!

As far as I know, you can't read a portion of an xml file. You would need to
read everything
up to the portion you want to identify that portion.

What you could try to do is:
- read in the entire file as an XmlDocument
- store it in the Cache (possibly with a dependency on the file)
- use a singleton-like scheme so it will be read once (if it is not in the
cache)
- this way there should be only a single copy of the document in memory
that is shared between all requests.
- you can then use xpath (SelectNodes, SelectSingleNode) to retrieve
the data you want.

For a read/write scenario I would not recommend this, but for a read-only
scenario it could work.


Hans Kesting
 
I have been going back and forth with the same issue. So
far, I have had some great luck using the dataset.ReadXml
method, loading the XML file at the start of the
application, then storing just one data table in the
application's cache object (Cache("product_table") =
DataSet1.Tables(0))

Granted, this is a simple application thus far, but
response times have been great. I am playing it by ear
that this will expand as much as I need it to (I've read
some harsh criticism of using saving a full DataSet to an
Application or Session object).
 
Back
Top