[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Keeping mdb files opened while mmapped
- To: Shlomi Vaknin <shlomivaknin@gmail.com>
- Subject: Re: Keeping mdb files opened while mmapped
- From: Hallvard Breien Furuseth <h.b.furuseth@usit.uio.no>
- Date: Tue, 17 Nov 2015 13:20:57 +0100
- Cc: openldap-technical@openldap.org
- In-reply-to: <CANyzh=has1Y2gkxMcEzxx7NVR+D74WPYUUaBws1Cn-ZLbv1hOA@mail.gmail.com>
- References: <CANyzh=has1Y2gkxMcEzxx7NVR+D74WPYUUaBws1Cn-ZLbv1hOA@mail.gmail.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
On 12. nov. 2015 00:38, Shlomi Vaknin wrote:
When I lsof my process, I am seeing that each mdb file is appearing twice (...)
I know that after mmaping a file, it is not needed to be kept open, and it
seems it is in lmdb.
By default the mmap is read-only, LDMB uses file operations for
updates. And it keeps an extra file descriptor with the O_DSYNC or
O_SYNC flag for writing the metapage, to avoid a sync() system call.
Unless you use MDB_WRITEMAP: Then it modifies the map directly and
omits the sync descriptor, but it still needs a descriptor if the
user calls mdb_env_set_mapsize() and on Windows for mdb_env_sync().
I know this might simply be an artifact and might not actually be a
contributing reason for my swap ins/outs, but I wanted to hear what do you
think about it?
If you've just written much of the database without MDB_WRITEMAP and
without sync'ing (i.e. not yet committed or you use MDB_NOSYNC),
then you'll have the new data cached for the filesystem and old data
in the map. But hopefully you didn't do that with half a gigabyte at
the same time as you worry about too high VM usage.
--
Hallvard