View Source

The Java Virtual Machine (JVM) is configured in {{<KIM_HOME>/bin/config/config(.bat)}}

Unlike the configuration in {{/config}}, the one in {{/bin/config}} is applied before the JVM has started. Thus, {{/bin/config/config(.bat)}} contains all options that cannot be modified after start-up. They can either be changed in the config script itself, or defined as environment variables.

* *{{JAVA_HOME}}* - The full path to the virtual machine.
(/) In a production environment, we recommend installing the JVM in a path with no spaces or special characters in it. For example, on Windows, we recommend {{c:\java}} instead of {{c:\Program Files\Java}}.
* *{{KIM_MAX_JAVA_HEAP}}* - The maximum memory that the KIM Server is allowed to allocate.
(/) Set to 2 GB for basic load and to 8 GB for maximum load (for 64 bit machine only). See the memory section below for details on memory consumption of resources.

h2. Memory
There are multiple factors that affect how much memory KIM requires. The total is the amount of memory required for each component.

h3. Size of GATE documents during annotation

If you enable semantic annotation in the KIM Server, you should reserve some memory for the in-memory representation of the documents during the annotation. The amount of memory per document depends on the document size. Please estimate the maximum size of a single document, and then refer to [memory consumption of GATE documents|Memory consumption of GATE documents] to determine the required memory.

Remember to multiply that number by the number of parallel annotation executions, configured [here|Configuring the KIM IE Modules#ParallelAnnotationConfiguration].

To reduce memory consumption, set small number of parallel annotation executions or disable semantic annotation altogether.

h3. Size of in-memory resources for semantic annotation

The pipeline for semantic annotation keeps some resources in-memory for improved performance. To enable parallel annotation executions, multiple copies of the pipeline are kept in-memory - one for each potential execution. Some of the in-memory resources are shared between the pipeline copies.

Thus, the amount of memory consumed for the in-memory resources for semantic annotation is calculated using the following formula:

{{Mem = sum for each enabled pipeline\{P1 + (N-1) \*P\}}}

* {{Mem}} is the total memory consumed
* {{P1}} is the memory required for the first instance of a pipeline
* {{N}} is the number of parallel annotation executions
* {{P}} is the amount of memory required for a pipeline copy

To reduce the required memory for this component, you can:
* reduce {{P1}}, by having a simpler pipeline
* reduce {{N}} as described above
* reduce {{P}} by making sure the pipeline copies share as much in-memory resources as possible
* disable semantic annotation altogether. That is useful in read-only public servers.

h3. BigOWLIM In-memory index

The BigOWLIM in-memory index takes a significant amount of memory determined by the [BigOWLIM configuration|Configuring the Semantic Repository].

h3. Query result cache

The query result cache is implemented via [SoftReferences|], so its size is automatically reduced.
(/) Leaving additional memory enables KIM to cache more query results, which improves performance.

h3. Other components

The other standard KIM components use a fairly constant amount of memory. In KIM Server 3.6, it is 550MB. This amount will be larger if there are custom components, initialized as KIM Extensions or services.

{tip:title= About memory use}

Avoid swapping. KIM only keeps in-memory data that is critical for performance. If the operating system puts some of KIM memory in swap, the speed advantage of keeping data in-memory will not only be negated, but reversed. If there is not enough physical memory, please reduce the memory requirements of KIM, using the advice above.{tip}