简体   繁体   中英

AppFabric caching - incredibly slow or configured wrongly?

Some details; Im running an out-the-box, vanilla configuration of AppFabric 1.1 on the same machine as IIS. I've not enabled AppFabrics's local cache, as im interested in the performance outside of this local caching boundary.

Now obviously in-proc caching like httpruntime cache is going to be super fast. Infact it is able to retrieve a dataset im testing with, which contains about 14,000 records (and is about 25MB when serialised) in something under 10 miliseconds.

However, retrieving the same amount of data from app fabric takes approximately 9 seconds. Obviously this is a huge difference and as I could never use this as any sort of replacement (which I was secretly hoping i might be able to).

Does this performance sound about right? Are there any obvious gotchas in the configuration im missing out?

I will try to answer....

First, you are not comparing the same thing : when you get something from HttpRuntime cache, you are getting a reference to the initial item in memory. If some code modify this item, all others users/threads will see the change. That's why it is sometimes recommanded to clone everything that you put into a local cache.

Because AppFabric Cache is designed for Web Farms, you can't do this because object needs to be sent over the network (even if the host is in the same machine). So, The data item is serialized using the NetDataContractSerializer.

AppFabric is not faster than HttpRuntime simply because it was not designed for this. It's designed for WebFarms and large ammount of data that leads applications to a better reliability, scalability and performance.

As an example, in my company we used only HttpRuntime Cache a few years ago. This is now completely impossible because we have more than 30 servers and the Database is overloaded : AppFabric is a perfect solution to reduce DB load and improve web app performance (items coming from the cache cluster and not loaded from the DB).

If you have only one server, it's pretty sure that we won't have any advantages using AppFabric. It's also recommanded to have dedicated cache host.

At the end, I'm sure there is also stuff to do on your object because a dataset of 14 000 is non optimal !

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM