Property RAMBufferSizeMB
RAMBufferSizeMB
Gets or sets a value that determines the amount of RAM that may be used for buffering added documents and deletions before they are flushed to the Directory. Generally for faster indexing performance it's best to flush by RAM usage instead of document count and use as large a RAM buffer as you can.
When this is set, the writer will flush whenever buffered documents and deletions use this much RAM. Pass in DISABLE_AUTO_FLUSH to prevent triggering a flush due to RAM usage. Note that if flushing by document count is also enabled, then the flush will be triggered by whichever comes first.
The maximum RAM limit is inherently determined by the runtime's available memory. Yet, an IndexWriter session can consume a significantly larger amount of memory than the given RAM limit since this limit is just an indicator when to flush memory resident documents to the Directory. Flushes are likely happen concurrently while other threads adding documents to the writer. For application stability the available memory in the runtime should be significantly larger than the RAM buffer used for indexing.
NOTE: the account of RAM usage for pending deletions is only approximate. Specifically, if you delete by Query, Lucene currently has no way to measure the RAM usage of individual Queries so the accounting will under-estimate and you should compensate by either calling Commit() periodically yourself, or by setting MaxBufferedDeleteTerms to flush and apply buffered deletes by count instead of RAM usage (for each buffered delete Query a constant number of bytes is used to estimate RAM usage). Note that enabling MaxBufferedDeleteTerms will not trigger any segment flushes.
NOTE: It's not guaranteed that all memory resident documents are flushed once this limit is exceeded. Depending on the configured Lucene.Net.Index.LiveIndexWriterConfig.FlushPolicy only a subset of the buffered documents are flushed and therefore only parts of the RAM buffer is released.
The default value is DEFAULT_RAM_BUFFER_SIZE_MB.
Takes effect immediately, but only the next time a document is added, updated or deleted.
Declaration
public virtual double RAMBufferSizeMB { get; set; }
Property Value
Type | Description |
---|---|
System.Double |