reading the DB vs. reading a text file...performance preference?

D

Darrel

I've been working on a fairly simple CMS for a fairly small site. Each page
is a DB query to grab the content for the page.

I also have some ancillary content that isn't specifically associated with
one specific page. For instance, the page footer, which is the same on every
page.

The authors can edit this content which is then stored in the DB. In terms
of retrieving it, I could query the DB on each request, or whenever the
content is changed via the admin tools, I could have it spit it out as a
text file, and then include the file with a plain-old include statement on
each page.

Performance-wise, is there a difference between the two? Is the effor to
write out the new text file from the DB worth any performance gain?

I realize this is probably hypothetic on the size of site I'm working on,
but i'd like to go ahead and use the best method if there is one.

-Darrel
 
S

Scott Allen

If the content ultimately resides in the DB, I'd avoid spitting out
the text files - that might be messy to clean up and the performance
gain would not be worth the effort.

A simpler solution would be to use memory caching (I'm assuming the
content is relatively small). You could keep the content itself in the
cache as a string to write into the page, or you could place the
content into a user control and use partial page caching.

Some more caching info:
http://msdn.microsoft.com/library/d...pp/html/aspnet-cachingtechniquesbestpract.asp
 
D

Darrel

If the content ultimately resides in the DB, I'd avoid spitting out
the text files - that might be messy to clean up and the performance
gain would not be worth the effort.

Thanks, Scott. I'll look into the cacheing option.

-Darrel
 
K

Kevin Spencer

If the content is more or less static, you could read it either from a file
or DB, and store it in the Application Cache, to minimize IO cost.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top