LMDB 中的内容是否始终同时存储在磁盘和内存中?
我想使用 LMDB 的 Rust 实现,但我似乎无法找到它是否始终在磁盘中和内存中保留一份副本,反之亦然。 我的理由是数据库将有一些缓存,任何溢出都会写入磁盘,但由于我在文档中找不到它,所以我不确定。
另一种情况是 LMDB 将其磁盘上的内容映射到内存,这适用于少量数据,但不适用于我想要的内容。
有谁知道 LMDB 在这方面如何运作?
I'm wanting to use the rust implementation of LMDB but I can't seem to find whether it would always maintain a copy of whats in memory also in the disk and viceversa.
My reasoning would be that the DB will have some cache and any overflows would be written to disk but since I can't find it in the documentation I'm not sure.
The other case would be that LMDB maps its contents on disk to memory and that would work for small quantities but not for what I have in mind.
Does anyone have an idea on how LMDB works on this regard?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您担心无法对不适合内存的数据集进行操作,没关系 - LMDB 确实可以处理这个问题。您的数据集不限于内存大小。
LMDB 是内存映射技术,允许开发人员在磁盘上读/写数据,就像在内存中一样 - 操作系统会完成所需的所有繁重工作
整个数据集都在磁盘上。它的某些部分在内存中。当需要不在内存中的部分时 - 操作系统从磁盘中获取它并通过将其放入进程的内存中将其提供给应用程序
If you are worried about not being able to operate on a dataset that does not fit in memory, you are ok - LMDB does handle that. Your dataset is not limited to the size of ram.
LMDB is memory-mapped which is a technique that allows developers to read/write data on disk 'like' it is in memory - the OS does all the heavy lifting required
The entire dataset is on disk. Some parts of it are in memory. When the parts that are not in memory are needed - the OS fetches it from disk and gives it to the application by putting it in the process' memory