intoTHEwild
intoTHEwild

Reputation: 468

Caching database query results on webserver in a database using .net cache provider classes

I have an e-commerce like site to build and given the frequency and volume of request that we would have to handle, its best to incorporate caching in our code base from the beginning itself. I read about .net 4's system.runtime.cache and system.web.cache. These classes provide cache at application level. There is also a possibility of implementing our own custom provider using outputcacheprovider interface.

Now I was thinking that it would be better to have a small db server at webserver itself which will cache the results of frequently made sql queries which could be server to the web page and will save me a round trip to actual db server and db access.

I went through a lot of blogs but i didnt find anything directly related to this. Now I have a few questions: 1. Is it good to have small dbserver at webserver to handle frequent queries ? 2. Is it possible to implement this kind of caching using outputcacheprovider ?

Upvotes: 3

Views: 1572

Answers (1)

Simon Halsey
Simon Halsey

Reputation: 5480

It wouldn't really do a lot other than put added load on your web server. The only time it might make a difference is if there sufficient lag on your network between the web server & db server to make it worthwhile.

The point of caching is you're holding the data in a processed form in a fast medium, ie memory.

You're better of looking at something like appfabric or memcache to provide your caching rather than a db.

Also, bear in find the difference between caching & outputcaching. caching is holding data in memory for your application to use as it needs. OutputCaching is storing the generated output for a page meaning that future requests get the cached version & you don't have to generate the page every time.

Upvotes: 5

Related Questions