469,602 Members | 1,619 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

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

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
Nov 18 '05 #1
3 1797
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/de...sbestpract.asp

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 10 Nov 2004 22:22:25 -0600, "Darrel" <no*****@nospam.com>
wrote:
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


Nov 18 '05 #2
> 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
Nov 18 '05 #3
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.

"Darrel" <no*****@nospam.com> wrote in message
news:##**************@tk2msftngp13.phx.gbl...
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

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Jeff Pritchard | last post: by
6 posts views Thread by Rajorshi Biswas | last post: by
reply views Thread by Einar Hst | last post: by
6 posts views Thread by Einar Høst | last post: by
13 posts views Thread by mloichate | last post: by
7 posts views Thread by John Dann | last post: by
3 posts views Thread by lizii | last post: by
6 posts views Thread by arne.muller | last post: by
13 posts views Thread by swetha | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.