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

Re: LMDB file size, again

Christian Sell wrote:
at the risk of being called stupid again: I am still labouring with said
issue. Before giving up my invest in LMBD, I'd like to try another route to
meet my requirements. Since the main issue is the file size under Windows, my
idea is to resize the map to the actual data size upon application shutdown.
My problem then would be to determine the actual datasize. Can somebody tell
me how that can be achieved?

What is your actual requirement?

Why are you setting a large mapsize in the first place, if you only want a smaller size at application shutdown? How much space are you *really* prepared to allow your application to use? Why aren't you configuring with that specific mapsize?

What are you going to do if/when your application actually needs to write beyond a particular size limit?

This is ultimately the question you must answer - how much space will you actually allow your app to use? Once you have that figure, configure it once and forget about it. It is *STUPID* to ask the OS to allocate space for you and then ask it to deallocate space repeatedly. You wind up fragmenting the disk and killing performance. Either you have enough disk space for the app's needs, or you don't. If you don't have enough space, you need to reconfigure your system environment. If you have enough space, allocate it and be done with it.


 > Howard Chu <hyc@symas.com> hat am 11. November 2015 um 22:51 geschrieben:
 > Christian Sell wrote:
 > > Hello,
 > > following up to my previous question regarding file size, I would like to ask
 > > about the recommended approach:
 > You're being stupid.
 > The documentation already clearly states:
 > http://symas.com/mdb/doc/group__mdb.html#gaa2506ec8dab3d969b0e609cd82e619e5
 > The size of the memory map is also the maximum size of the database.
 > The value should be chosen as large as possible, to accommodate future
 > growth of the database.
 > > 1. set a low file size initially, watch for MDB_MAP_FULL return codes and
 > > increase the file/map size stepwise as needed
 > No. That would be stupid.
 > > 2. choose a large file size and reduce the size by doing a mdb_copy when the
 > > application shuts down
 > No. That would be stupid.
 > > or maybe a combination of the two? How does SQLightning handle this (2.
 > > doesn't sound practical)?

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