开发者

EHCache write-behind possible issue if system crashes

New to caching...

I was looking into Spring's EHCache and I found its "write-behind" new feature very interesting. Data is written to the cache first and then to the underlying database in an asynchronous way reducing the load on the database through time-shifting, rate-limiting, or conflation (by the way, do other caches have the same capabilities?). It just sounds great for what I need.

Now..

What happens if my server/system/cache crashes badly (i mean really badly) for any reasons? Would I loose data stored in the cache that is waiting to be loaded into the database? Can I prevent this from happening by using 'Big Memory' or 'Disk Store' and would these options be convenient?

开发者_如何学Go

Thank you very much.


A Terracotta cluster would give you a durable write-behind queue http://ehcache.org/documentation/apis/write-through-caching#using-a-combined-read-through-and-write-behind-cache and http://vimeo.com/21193026


Would I loose [sic] data stored in the cache that is waiting to be loaded into the database?

Yes, you would. This the trade-off you have to accept with "write-behind" caches.

If you need transactional integrity, you need to write directly to the transactional backing store, and then either flush the entry from the cache ("write-back"), or update the cache synchronously with the write to the data store ("write-through").

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜