views:

31

answers:

3

Hi,

I'm building my website and I'd like to limit calls to my MYSQL database.

One idea I have is to use XML files to present information that does not need to be updated as regularly as every page load.

Two example are

  1. Site navigation which might only change once a week.

  2. The number of items in stock which will in most situations only need to be updated when an item becomes out of stock.

I have a feeling this is a good solution, however my experience with XML is quite limited, so I'd like some feedback before delving into it.

Many thanks.

+1  A: 

Just use memcache, xcache or any other caching solution to cache your SQL requests.

Māris Kiseļovs
Thanks for pointing these out. I had no idea they existed. They are certainly going to help in solving some other performance issues I have.
matt
A: 

This might be a good aproach.

Supplying your xml-Files with E-tags forces the Browser to do the caching. So even your Webserver requests could be handled faster.

daniel
This is what I was hoping. Ideally the XML file would be loaded into the cache rather than each time it was called.
matt
A: 

If you want to use XML for performance reasons, don't do it. Use cache instead, as Märis suggested. If you want to use XML because it is a better primary representation of your model, than by all means, do it ! Be aware that there is a few problems you will have to solve (concurrent edits on your XML files for example).

XML can be a better format to store hierarchical data than a relational database, like your navigation.

Guillaume
Actually only use of XML is to share data between different systems. For all other uses it's a bad choice.
Māris Kiseļovs
I strongly disagree with you. Used correctly, XML can be a good solution to store data as well. The problem is more the filesystem, which doesnt support locking / transactions, ... I could point you to quite a few respectable products that take the XML approach.
Guillaume
matt
If the source of your data is a database, you are using XML files as a caching mechanism. In this case, you should go with a caching solution (memcache or other).
Guillaume