is this parameter something that is passed to the mmap call? https://man7.org/linux/man-pages/man2/mmap.2.html could you share link to the code that uses this parameter? i'd like to understand how its used so i understand the perf implications (setting it too high than necessary).
On Tue, Sep 12, 2023 at 11:57 AM Howard Chu <[email protected]> wrote: > 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/ >
