473,785 Members | 3,352 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading the DB vs. reading a text file...performa nce 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 1992
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:##******** ******@tk2msftn gp13.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
3111
by: Jeff Pritchard | last post by:
I have an MDB that contains a single table. Checkweigher data is being continuously written to this MDB from a dedicated workstation over a network into the MDB on the server at the rate of about 120 records a minute. This may increase in the future to about 200. The records are not large. We have other workstations that run sessions on Terminal Server querying this MDB, doing things like plotting the last hours data on a graph or...
6
6372
by: Rajorshi Biswas | last post by:
Hi folks, Suppose I have a large (1 GB) text file which I want to read in reverse. The number of characters I want to read at a time is insignificant. I'm confused as to how best to do it. Upon browsing through this group and other sources on the web, it seems that there are many ways to do it. Some suggest that simply fseek'ing to 8K bytes before the end of file, and going backwards is the way. In this case, am I guaranteed best results...
0
1382
by: Einar Høst | last post by:
Hi, I'm reading data from a text file, and having read a bit on performance and memory, I'm wondering how it could be done in the fastest, most frugal way. The data comes in messages, one per line, in a text file. I'm interested in one of six messages, but I don't think there's any guarantee in the ordering of the messages. Each message is identified by the first six characters in the line.
6
3554
by: Einar Høst | last post by:
Hi I'm trying to learn a bit about performance, hope someone can help me out I have a text file with 8-bit characters in it. In order to improve performance, I'm using a BinaryReader instead of a StreamReader. I've made two versions of my method, one which uses typesafe code, and one which uses unsafe code with pointers. I've read several places that direct pointer access will eliminate bounds-checking when accessing an array, and would...
13
3977
by: mloichate | last post by:
I must read a very heavy-weight text plain file (usually .txt extension) )and replace a given character with another given character in all text inside the file. My application was working pretty well with this below shown code (code placed in a buttonclick event after selecting the file in a normal OpenFileDialog): --------------------------------- System.IO.StreamReader sr = new System.IO.StreamReader(@"C:\1.txt"); string all =...
7
6063
by: John Dann | last post by:
I'm trying to read some binary data from a file created by another program. I know the binary file format but can't change or control the format. The binary data is organised such that it should populate a series of structures of specified variable composition. I have the structures created OK, but actually reading the files is giving me an error. Can I ask a simple question to start with: I'm trying to read the file using the...
3
1806
by: lizii | last post by:
i have a file - which on each line has some data i need to fill into a box - now although reading in the data is simple enough and putting it in the correct box will be no problem, as i can just read a lilne then put into the corresponding box...it just seems like a task i should be able to complete in a few lines...rather than quite a few commands. for example what i do at the moment is: read a line place into first text box
6
5273
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
13
3713
by: swetha | last post by:
HI Every1, I have a problem in reading a binary file. Actually i want a C program which reads in the data from a file which is in binary format and i want to update values in it. The file consists of structures of type---- struct record { int acountnum; char name; float value;
0
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.