Range Indexes and Mapped File Initialization Errors
09 November 2021 04:23 PM


If your index settings have a very large number of range indexes specified (on the order of thousands or even tens of thousands), you may find your MarkLogic Server instance returning a message saying that it "Cannot allocate memory" - even when your OS monitoring metrics indicate that there appears to be plenty of unused RAM.

XDMP-FORESTERR: Error in startup of forest: SVC-MAPINI: Mapped file initialization error: mmap: Cannot allocate memory


The issue is not how much memory a system has, but how it's being used. In the interests of performance, MarkLogic Server indexes your content upon ingestion to the system, then memory maps those indexes to serialized data structures on disk. While it's true that each of those memory maps requires some amount of RAM, if you've got thousands of indexes and system monitoring is reporting RAM to spare, then you might be running up against Linux's default vm.max_map_count value.

While it's possible to get past this issue by simply increasing the vm.max_map_count limit, you should seriously consider revisiting your index usage towards the use of Template Driven Extraction (TDE), as 1) it's likely the current indexing scheme could be replaced by a different one that uses far fewer indexes and 2) when your configuration exceeds on the order of 100 or so range indexes, you'll likely need to take special care to size and manage your topology so that you don’t run out of system resources, as well as potentially make configuration changes to the linux kernel on the d-nodes to which the relevant forests are assigned.


Additional Reading:

  • "The index behind TDE views is the triple index, not range indexes. We heard that people hit a memory limit when they created many columns (and therefore many range indexes) in the same database – the limit was hundreds, and people wanted to create tens of thousands. Now there is no effective limit to the number of columns you can create in a database." (
  • "If you find yourself planning to make thousands (or even hundreds) of range indexes, it’s probably worth stepping back and rethinking about how the data will be represented." (
(5 vote(s))
Not helpful

Comments (0)