0

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?

sel-fish
  • 4,121
  • 2
  • 18
  • 37

1 Answers1

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()) {
    ...
  }
ren
  • 3,653
  • 7
  • 47
  • 93