← Back to team overview

graphite-dev team mailing list archive

Re: [Question #191807]: what about using mmap?

 

Question #191807 on Graphite changed:
https://answers.launchpad.net/graphite/+question/191807

Amos Shapira posted a new comment:
BTW - just re-reading your previous answer I noticed:

"repeatedly mapping huge blocks of memory like that might not be a huge
speedup."

I'm referring to the "REPEATEDLY" part - the way mmap is usually used (in C):
1. open(2) a file.
2. mmap(2) it (or multiple parts of it, if you like) into memory, save the virtual address pointer.
3. CLOSE(2) the file - there is usually no use for the file descriptor and you can save system resources.
4. access the content of the file through the pointer as you see fit

The kernel will page in pages from the file into memory as they are
accessed and flush them out periodically (or you can force flush with
extra system calls if you must) and when you unmap(2) the file.

The point is that mmap() is a once-per-file setup thing and after that
you just keep using it.

-- 
You received this question notification because you are a member of
graphite-dev, which is an answer contact for Graphite.