Leveldb limit testing - limit Memory used by a program

余生长醉 提交于 2019-12-25 09:30:12

问题


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) How can I configure the application so that the key value pairs are always fetched from the disk?

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


回答1:


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()) {
    ...
  }


来源:https://stackoverflow.com/questions/38469966/leveldb-limit-testing-limit-memory-used-by-a-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!