为内存数据结构增加耐久性 [英] Adding durability to in-memory data structures

查看:76
本文介绍了为内存数据结构增加耐久性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您可以采用哪些常用技术来增加内存数据结构的耐用性(即,如果进程崩溃,您可以保留对该数据结构的所有以前执行的操作?

如果我的数据结构只涉及一个元组列表,那么我只需将它们存储在一个SQL数据库中,这将给我免费的耐久性。但是如果我的数据结构是一个图形或一个树呢?

If my data structure involves just a list of tuples, then I would just store them in a SQL DB and that would give me durability for free. But what if my data structure was a graph or a tree?

我可以想到的一件事是将所有操作显式记录到磁盘(仅追加日志),如果发生崩溃,请重播日志以保留以前的状态。如果日志变得太大,那么将会有压缩步骤。我猜这是一个数据库引擎在内部执行持久性(检查点是这个进程被调用)?

The one thing I could think of is to explicitly log all operations to disk (append-only log) and in the event of a crash, replay the log to preserve the previous state. If the log becomes too big, then there will be a compaction step. I'm guessing this is what a database engine does internally for durability (checkpointing is what this process is called)?

请注意,这不是整个数据集不适合内存的场景。

Btw note that this is not a scenario where the entire dataset doesn't fit in memory.

推荐答案

您可能需要尝试对象流行引擎。对于.NET,您可能需要尝试 Bamboo.Prevalence ,这是一个名为一个href =http://www.prevayler.org/wiki/ =nofollow noreferrer> Prevayler for Java。

You might want to try an object prevalence engine. For .NET, you might want to try Bamboo.Prevalence, which is a port of a similar engine called Prevayler for Java.

这篇关于为内存数据结构增加耐久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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