473,320 Members | 2,054 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,320 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 1218
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.