Increase maximum mmaps() used by each LevelDB instance from 1000 to 4096 on 64 bit systems. #13860

pull clemtaylor wants to merge 1 commits into bitcoin:master from clemtaylor:master changing 1 files +2 −2
  1. clemtaylor commented at 1:52 am on August 3, 2018: contributor

    By default LevelDB will only mmap() up to 1000 ldb files for reading, this default is arbitrarily small.

    Once the first 1000 files are mmap()ed, it falls back to using file descriptor based IO which eventually causes problems for handling new sockets due to the use of select(). Increasing the number of mmaps() used will hold off running into the 1024 file descriptor (default) limit for select().

  2. Increase maximum number of read-only mmaps() used by each LevelDB instance from 1000 to 4096 on 64 bit systems.
    By default LevelDB will only mmap() up to 1000 ldb files for reading, this default is arbitrarily small.
    
    Once the first 1000 files are mmap()ed, it falls back to using file descriptor based IO which eventually
    causes problems for handling new sockets due to the use of select(). Increasing the number of mmaps() used
    will hold off running into the 1024 file descriptor (default) limit for select().
    9174f94126
  3. fanquake commented at 1:55 am on August 3, 2018: member

    You’ll also want to send this PR to our upstream leveldb repo. Then it can be merged here next time we update the subtree. The tests will fail here because a subtree is being edited.

    You might also be interested in reviewing #13741.

  4. fanquake added the label Upstream on Aug 3, 2018
  5. fanquake commented at 8:09 am on August 3, 2018: member
  6. gmaxwell commented at 8:52 pm on August 3, 2018: contributor

    As far as I can tell, the limit was added to leveldb in the first place due to a largely misguided effort to avoid VM exhaustion on 32-bit hosts. Now, we don’t use mmap on 32-bit at all– the only reason I see to not eliminate the limit entirely is because there is a OS map limit, and the software wouldn’t handle hitting it gracefully. 4096 is more than enough to cover our current needs and still tiny compared to the OS limits on Linux.

    Not upping this limit is almost certainly bad for performance, and it’s also causing us to run out of FDs due to additional FD use (which was made worse by other recent PRs that changed the FD limits under the false assumption that leveldb wouldn’t actually use that many FDs– false due to running into the map limit). We should fix the FD constraints by switching to poll, but even with that fixed we’re still left with worse performance due to hitting the map limit.

    I ACKed this in the upstream repo.

  7. laanwj added the label UTXO Db and Indexes on Aug 6, 2018
  8. laanwj added this to the milestone 0.17.0 on Aug 9, 2018
  9. laanwj commented at 2:52 pm on August 9, 2018: member
    https://github.com/bitcoin-core/leveldb/pull/19 has been merged, please update to update the subtree instead
  10. fanquake commented at 8:52 am on August 10, 2018: member
    Closing in favour of #13925.
  11. fanquake closed this on Aug 10, 2018

  12. laanwj referenced this in commit 71dec5c81f on Aug 10, 2018
  13. PastaPastaPasta referenced this in commit 6142e0c324 on Feb 2, 2021
  14. PastaPastaPasta referenced this in commit 02c02aa191 on Feb 3, 2021
  15. PastaPastaPasta referenced this in commit 2f301fdb09 on Feb 4, 2021
  16. DrahtBot locked this on Sep 8, 2021
  17. gades referenced this in commit e4849f69ed on Apr 1, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-04 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me