Leveldb限制测试-限制程序使用的内存 [英] Leveldb limit testing - limit Memory used by a program

查看:391
本文介绍了Leveldb限制测试-限制程序使用的内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在对构建在Leveldb上的应用程序进行基准测试.我想以一种始终从磁盘而不是从内存读取键值的方式配置它.
为此,我需要限制程序消耗的内存.
我使用的键/值对分别为100个字节和100000个字节,这使得它们的大小等于10 MB.如果使用ulimit将虚拟内存限制设置为小于10 MB,我什至无法运行命令Makefile.

I'm currently benchmarking an application built on Leveldb. I want to configure it in such a way that the key-values are always read from disk and not from memory.
For that, I need to limit the memory consumed by the program.
I'm using key-value pairs of 100 bytes each and 100000 of them, which makes their size equal to 10 MB. If I set the virtual memory limit to less than 10 MB using ulimit, I can't even run the command Makefile.

1)如何配置应用程序,以便始终从磁盘中获取键值对?

1) How can I configure the application so that the key value pairs are always fetched from the disk?

2)ulimit -v是什么意思?限制虚拟内存是否转化为限制程序在RAM上使用的内存?

2) What does ulimit -v mean? Does limiting the virtual memory translate to limiting the memory used by the program on RAM?

推荐答案

也许无需减少可用内存,而只需按照

Perhaps there is no need in reducing available memory, but simply disable cache as described here:

  leveldb::ReadOptions options;
  options.fill_cache = false;
  leveldb::Iterator* it = db->NewIterator(options);
  for (it->SeekToFirst(); it->Valid(); it->Next()) {
    ...
  }

这篇关于Leveldb限制测试-限制程序使用的内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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