[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LMDB physical file size



Christian Sell wrote:
Hello,

we are using LMDB as the underlying storage engine for a lightweight + high
performance special-purpose object + mass data database. I have 2 questions
about the size of the physical file used by LMDB:

To create the environment, we are using a mapsize of 1 GiB and the flags
MDB_NOSUBDIR | MDB_NOLOCK. Under Linux, this results in one file with a size
that seems to correspond to the size of the data actually stored. However, under
Windows, the file size is the same as the mapsize, namely 1 GiB. We are
currently using env_copy2 and MDB_COMPACT to push this down every time the env
is closed, but I fear that this will become very slow with large databases.

The same issue surfaced under Linux when we were recently experimenting with the
MDB_WRITEMAP option to improve performance when dealing with very large data
sets. This option caused also the Linux file size to go up to 1 GiB, even though
the actual data was < 50 K.

We'd like to hear if there are ways to improve this.

No.

This is how memory mapped files work on Windows. There is no way to change that.

https://msdn.microsoft.com/en-us/library/windows/desktop/aa366537%28v=vs.85%29.aspx

Likewise for writable mmaps on POSIX systems. Read your operating system documentation.

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/