我应该对不断变化的数据使用缓存吗? [英] Should I use caching for data that keeps changing?

查看:150
本文介绍了我应该对不断变化的数据使用缓存吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Web应用程序,某些用户特定数据将继续更改(例如,上次访问时间,可以每2分钟更新一次)。现在数据在一个sql表中,它被复制到其他数据库服务器。

I have a web application that some user specific data will keep on changing (for example Last Access Time, which could be updated like every 2 minutes). Now the data is in a sql table, which got replicated to other db servers.

更新的数据将始终只对用户可用,因此它们不会被共享(私有数据但保持开启状态)更新)。

The data updated will always only available to on user, so they are not shared (private data but keeps on updating).

我想知道我是否应该在这种情况下使用appfabric缓存? sql表是可靠的,但复制和写入物理磁盘可能非常昂贵(有时在分析器中看到)。

I am wondering if I should use appfabric caching for this kind of scenario? sql table is reliable but the replication and write to physical disk can be quite expensive (as sometimes seen in the profiler).

使用缓存可以删除写入db部分,但我猜复制仍然是一个问题?

Using caching could remove the write to db part, but I guess the replication is still an issue?

非常感谢

Jerry

 

 

 

推荐答案

app的用法之一-fabric缓存是会话数据,即用户特定的数据,app-fabric缓存也提供复制,因此如果一台机器出现故障,数据仍将在另一台机器上可用。

One of the usage of app-fabric caching is session-data, that is user-specific data and app-fabric caching also provide the replication, so in case one machine fails, data will still be available on the other machine.

 有一件事你应该记住,缓存中的所有数据都保存在内存中,因此如果存在数据副本的机器,数据将会丢失。因此,如果数据需要绝对持久,那么db可能是最好的解决方案,否则app-fabric
缓存将提升应用程序的性能。一个app-fabric缓存服务器可以轻松支持每秒10K写入。

 One thing that you should keep in mind that all data in caching is kept in-memory so if both the machines where copy of data is there, data will-be lost. So if data need to be absolutely durable, then probably db is the best solution, otherwise app-fabric caching will boost the performance of your application. One app-fabric caching server can easily support 10K write per second.


这篇关于我应该对不断变化的数据使用缓存吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆