[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openldap-technical
Subject:    Re: Trying to understand mdb_env_set_mapsize
From:       Howard Chu <hyc () symas ! com>
Date:       2023-09-12 18:47:18
Message-ID: 59aea463-5dfe-05ca-3113-c94aeaa02f0f () symas ! com
[Download RAW message or body]

Siddharth Jain wrote:
> Hello,
> 
> can someone help me understand this parameter:
> http://www.lmdb.tech/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5
> 
> 1. why does a user need to specify this apriori? Other databases don't require user \
> to declare the size of the db beforehand. its not something a user knows in \
> advance.

It's not the size of the database. It's the maximum size the database will be allowed \
to grow to. Of course you don't need to know the actual size of the DB in advance.

You ought to know how much storage you're willing to commit to the DB. At most, it is \
the size of the free space on your storage device.

As for why: because setting the maximum size once, up front, gives higher performance \
than incrementally growing during runtime. If you don't care about performance, and \
can't handle this question, use some other slower DB.

> 2. quoting: "The size of the memory map is also the maximum size of the database.". \
> what happens when the size of the db overflows this parameter?

It can't overflow. The DB will reject writes when it reaches that limit.

> 3. what is the trade-off if a user sets this parameter too large than  is \
> necessary?

The map just uses virtual address space, which is limited to 128TB on current 64bit \
CPUs. If you try to use all of that up, you won't have space for shared libraries in \
that process.
> 
> S.


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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic