473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

better performance

Some of my db-driven web pages rarely change. They pull the exact same data
every time (the table is almost read-only). Should I consider using page
caching? or do i just need to turn on caching in IIS 6? I'm new to this.
could someone point me to the right direction?

Thanks,
Aaron
Jul 21 '05 #1
5 1223
If the data is only used on a single page, you could use page caching
(and it will definitely be better than no caching).
But if you are using the same "semi-static" data on multiple pages,
consider using the application-wide Cache. The same objects are
available from every page (as Page.Cache).
You can retrieve the data once from the database, add it to the cache
and then on subsequent pages, just retrieve the data from the cache.

Quick code (not guaranteed to compile as-is, read the documentation):

Page_Load(){
// try to retrieve data from cache
DataSet myData = Cache["MyDataKey"] as DataSet;

if (myData == null){
// data was not in cache, retrieve from database
myData = LoadDataSetFromDatabase();
this.Cache.Insert("MyDataKey", myData);
}

// use myData
}

The different overloads of Cache.Insert() allow you to specify different
rules for how long the data should stay in the cache.
Joshua Flanagan
http://flimflan.com/blog

Aaron wrote:
Some of my db-driven web pages rarely change. They pull the exact same data
every time (the table is almost read-only). Should I consider using page
caching? or do i just need to turn on caching in IIS 6? I'm new to this.
could someone point me to the right direction?

Thanks,
Aaron

Jul 21 '05 #2
Hi Aaron:

Take a look at the caching quickstart [1], the simplest approach for
you would be to use ASP.NET Page Output Caching [2].

[1]
http://samples.gotdotnet.com/quickst...goverview.aspx

[2]
http://samples.gotdotnet.com/quickst...utcaching.aspx
HTH,

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

On Sun, 22 May 2005 11:42:51 -0700, "Aaron" <ku*****@yahoo.com> wrote:
Some of my db-driven web pages rarely change. They pull the exact same data
every time (the table is almost read-only). Should I consider using page
caching? or do i just need to turn on caching in IIS 6? I'm new to this.
could someone point me to the right direction?

Thanks,
Aaron


Jul 21 '05 #3
Good question, Aaron.

Note that you have said that "some of my... pages rarely change." This
brings up the question of whether these pages may use the same data as
others. That is, Page-caching is useful if the data is only used by one
page. However, if the data is used by more than one page, you're looking at
a different caching mechanism, such as Application Cache (if the data is
used by all user clients on more than one page), or Session (if the data is
used only by one user client on more than one page).

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Aaron" <ku*****@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...
Some of my db-driven web pages rarely change. They pull the exact same
data every time (the table is almost read-only). Should I consider using
page caching? or do i just need to turn on caching in IIS 6? I'm new to
this. could someone point me to the right direction?

Thanks,
Aaron

Jul 21 '05 #4
Thanks for your replies.

Is there anything I can do in the database design to optimize for this as
well?

db table example: only 2 columns

ID | LONGTEXT
1 | some ...
2 | text ...
3 | here ....

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...
Good question, Aaron.

Note that you have said that "some of my... pages rarely change." This
brings up the question of whether these pages may use the same data as
others. That is, Page-caching is useful if the data is only used by one
page. However, if the data is used by more than one page, you're looking
at a different caching mechanism, such as Application Cache (if the data
is used by all user clients on more than one page), or Session (if the
data is used only by one user client on more than one page).

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Aaron" <ku*****@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...
Some of my db-driven web pages rarely change. They pull the exact same
data every time (the table is almost read-only). Should I consider using
page caching? or do i just need to turn on caching in IIS 6? I'm new to
this. could someone point me to the right direction?

Thanks,
Aaron


Jul 21 '05 #5
Base on what you told me, no. It looks pretty straightforward. You might use
a Stored Procedure, rather then sending a SQL query, and get a slight boost.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Aaron" <ku*****@yahoo.com> wrote in message
news:un**************@TK2MSFTNGP12.phx.gbl...
Thanks for your replies.

Is there anything I can do in the database design to optimize for this as
well?

db table example: only 2 columns

ID | LONGTEXT
1 | some ...
2 | text ...
3 | here ....

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uD**************@TK2MSFTNGP15.phx.gbl...
Good question, Aaron.

Note that you have said that "some of my... pages rarely change." This
brings up the question of whether these pages may use the same data as
others. That is, Page-caching is useful if the data is only used by one
page. However, if the data is used by more than one page, you're looking
at a different caching mechanism, such as Application Cache (if the data
is used by all user clients on more than one page), or Session (if the
data is used only by one user client on more than one page).

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Sometimes you eat the elephant.
Sometimes the elephant eats you.

"Aaron" <ku*****@yahoo.com> wrote in message
news:en**************@TK2MSFTNGP09.phx.gbl...
Some of my db-driven web pages rarely change. They pull the exact same
data every time (the table is almost read-only). Should I consider using
page caching? or do i just need to turn on caching in IIS 6? I'm new to
this. could someone point me to the right direction?

Thanks,
Aaron



Jul 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lukas Holcik | last post by:
Hi everyone! How can I simply search text for regexps (lets say <a href="(.*?)">(.*?)</a>) and save all URLs(1) and link contents(2) in a dictionary { name : URL}? In a single pass if it could....
8
by: Randell D. | last post by:
Folks, I once read an article in Linux Format whereby a technical writer had made performance recommendations on a LAMP environment. One of the points raised was for small columns in a database,...
133
by: Gaurav | last post by:
http://www.sys-con.com/story/print.cfm?storyid=45250 Any comments? Thanks Gaurav
19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
39
by: bazad | last post by:
Hi, I am not using C all the time. I have a general understanding of C and nothing else. The recent reply to use strlcpy and strlcat showed me that I am not aware of the best and safe...
1
by: Arjen | last post by:
Hi, Sometimes I see this: (string)DataBinder.Eval(Container.DataItem, "Answer") And sometimes this: Eval(Container.DataItem, "Answer") What is better (faster/performance) when publishing...
5
by: serge | last post by:
Is it generally or almost always better to have multiple small SPs and functions to return a result set instead of using a single big 1000+ lines SP? I have one SP for example that is 1000+...
10
by: rcamarda | last post by:
I have created a table that contains buckets to hold activitives of enrollment for each of our admissions officer for each day of an enrollment session. I have an UPDATE that builds rolling totals...
34
by: pamela fluente | last post by:
I would like to hear your *opinion and advice* on best programming practice under .NET. Given that several time we cannot change: MyCollection.Clear into the instantiation of a NEW...
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.