Sometimes your system throws out of memory exception while using NCache. This usually happens when Maximum Size for the cache is not specified correctly. Often, processing overhead is not kept into consideration while specifying the Maximum Size.
Workaround
In order to resolve out of memory issue, NCache has provided a memory based cache, where you can specify an upper limit on the size of the cache in MB. Please specify correct Maximum Size for your cache.
You should specify a Maximum Size which, if completely consumed, still leaves enough space in the system so that it never goes under low resources. While specifying the cache size, consider the following factors:
-
Average size of Sessions or Objects.
-
Number of expected Sessions or Objects.
-
Available memory for the NCache process.
Then you can calculate the required memory by keeping the following in mind.
-
15% Overhead per session.
-
15-20% overhead for processing. If object size is greater than 80KB, this ratio may be little bit high.
See Also