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

Discussion in 'ASP .Net' started by Darrel, Nov 11, 2004.

  1. Darrel

    Darrel Guest

    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
    Darrel, Nov 11, 2004
    #1
    1. Advertising

  2. Darrel

    Scott Allen Guest

    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

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

    On Wed, 10 Nov 2004 22:22:25 -0600, "Darrel" <>
    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
    >
    Scott Allen, Nov 11, 2004
    #2
    1. Advertising

  3. Darrel

    Darrel Guest

    > 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
    Darrel, Nov 11, 2004
    #3
  4. 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" <> wrote in message
    news:##...
    > 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
    >
    >
    Kevin Spencer, Nov 11, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer

    Credit Card Gateways - Your preference?

    VB Programmer, Apr 28, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    351
    VB Programmer
    Apr 29, 2005
  2. Fran
    Replies:
    0
    Views:
    341
  3. Joe Hughes
    Replies:
    1
    Views:
    484
    Douglas Adams
    Jul 19, 2005
  4. Roland
    Replies:
    0
    Views:
    473
    Roland
    May 26, 2005
  5. Brock

    Preference: Header File OR Compile Flags?

    Brock, Dec 9, 2003, in forum: C Programming
    Replies:
    4
    Views:
    329
    Dan Pop
    Dec 11, 2003
Loading...

Share This Page