An increase in the maximum inline size requires more memory
for storing the serialized documents. Therefore, it generally also
requires an increase in the JVM maximum heap size.
A heavily loaded system that is processing many documents can
rapidly saturate the JVM heap memory. To avoid an OutOfMemoryError,
increase the JVM maximum heap size by an amount corresponding to
the size of the inline documents multiplied by the number of documents
that are typically executed at any given time.
JVM maximum heap size increase = (inline documents size) x (average
number of documents processed).
Calculating the JVM maximum heap size
In this example, the current
JVM maximum heap is set to 512 MB and the maximum inline size is
64 KB. The server must be configured for the scenario where 10 jobs
are run simultaneously, and each job has 9 input files and 1 result file
(a total of 10 files per job and 100 files processed simultaneously).
All the files are under 512 KB in size.
To store all the files
inline, set the maximum inline size o at least 512 KB.
The
required increase in the JVM maximum heap size is calculated using
the following equation:
(512 KB) x (100) = 51200 KB, or 50
MB
The JVM maximum heap size must be increased by 50 MB for
a total of 562 MB.
Considering heap fragmentation
Setting the size of inline documents
to large values raises the risk of an OutOfMemoryError on systems
that are prone to heap fragmentation. To store a document inline,
the JVM heap memory must have sufficient contiguous space. Some
operating systems, JVMs, and garbage collection algorithms are prone
to heap fragmentation. Fragmentation decreases the amount of contiguous
heap space and can lead to an OutOfMemoryError even when sufficient
total free space exists.
For example, previous operations
on the application server left the JVM heap in a fragmented state,
and the garbage collector cannot compact the heap sufficiently to
regain large blocks of free space. An OutOfMemoryError can occur
even though the JVM maximum heap size was adjusted for an increase
in maximum inline size.
To account for heap fragmentation,
the inline document size must not be set higher than 0.1% of the
total heap size. For example, a JVM maximum heap size of 512 MB
can support a maximum inline size of 512 MB x 0.001 = 0.512 MB,
or 512 KB.