开发者

AppFabric vs asp.net cache with sqldependency performance

开发者 https://www.devze.com 2023-04-08 05:49 出处:网络
I\'m working on a plan to increase performance and scalability of a web app by caching a user database for a WCF web service.Goals are to increase performance by accessing this data inProc vs a round

I'm working on a plan to increase performance and scalability of a web app by caching a user database for a WCF web service. Goals are to increase performance by accessing this data inProc vs a round trip the database server, as well as increase scalability of the service by reducing the load on the database server, thus allowing more web servers to be added to increase scale.

In researching AppFabric, I really don't see the value in my situation be开发者_运维技巧cause it seems like for the most part, I'm just replacing a round trip to the database with a round trip to a cache cluster (which seems like it might even have more overhead than the db to keep nodes in synch).

For the performance question, it seems like using the asp.net cache (in process) would be much faster than a round trip to the cache cluster, even though the data is in memory on those servers, and even if some of it is cached locally (I believe that would still be out of process from the web app).

For the scalability issue, it also seems easier to be able to add identical web servers to a web farm (each caching the user data in process), rather than manage a cache cluster seperately which adds complexity.

With that said, could someone explain why I would choose one approach over the other, given my stated goals? If you recommend the AppFabric approach, can you explain how the performance would be better than storing data in the asp.net cache in process.

Thanks!


You are right that the App fabric cache is stored out of process.

When the request comes in for a app fabric cache item, there is first a lookup to find where the item is, then a wcf net.tcpip call to get the item. Therefore, it will be slower than asp.net caching. But there are times when appfabric caching is better:

  • You do not loose the cache when the application pool is recycled.
  • If you have 100 web servers then you need to get the data from the database once, not 100 times
  • If you are running Enterprise Edition of windows you do not loose the cache if a machine goes down


I found this topic on codeproject. Hope it can answer your question


you should consider NCache as an other option. NCache is an extremely fast in-memory distributed cache which reduces the performance bottlenecks associates with the database enhance the scalability of the app.

As far as use of asp.net cache is concerned, you should keep into mind its limitations as well. it is good for small web farms only. but when the number of servers grow, asp.net cache may ends up with some performance and scalability issues due to its in-process nature. in a larger web garden you need to have an in-memory distributed cache. Read this for reference

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号