If your Discovery Service uses Ehcache (rather than Redis) for caching, then to reduce the risk of running out disk space, you may want to change its default heap size and off-heap size, in addition to configuring merely the maximum number of entries in the heap. To do so, edit the Ehcache configuration file as found inside the library discovery-lightweight-client.jar on your client.
Procedure
- In your Content Delivery server environment, go to the location of your Content Service.
- Go to the services/odata-v4-framework/ subfolder.
- Unzip the JAR file discovery-lightweight-client.jar, as found in that folder, to a location of your choosing.
- Open the file ehcache-default.xml for editing.
- Inside the
cache section for your cache, find the heap subelement.
- Replace the
heap subelement with a subsection called <resources>.
- Within this subsection, set the heap size and off-heap size as follows:
<heap unit="entries">HEAPSIZEINENTRIES</heap>
<heap unit="HEAPBYTEUNIT">HEAPSIZEINBYTES</heap>
<offheap unit="OFFHEAPBYTEUNIT">OFFHEAPSIZEINBYTES</heap>
where:
- HEAPSIZEINENTRIES is the maximum number of entries in your heap (
10000 is a recommended value).
- HEAPBYTEUNIT is the unit of measurement for the value of the
heap element (GB is a recommended value).
- HEAPSIZEINBYTES is the size of the heap in number of bytes, measured in the unit of measurement you specified, (
2 is a recommended value if you used GB).
- OFFHEAPBYTEUNIT is the unit of measurement for the value of the
offheap element (MB is a recommended value).
- OFFHEAPSIZEINBYTES is the size of the off-heap in number of bytes, measured in the unit of measurement you specified, (
500 is a recommended value if you used MB).
The resulting recommended configuration is:
<resources>
<heap unit="entries">10000</heap>
<heap unit="GB">2</heap>
<offheap unit="MB">500</heap>
</resources>
- Save and close ehcache-default.xml.
- Recreate discovery-lightweight-client.jar from these modified files. Refer to the Oracle Java documentation topic "Creating a JAR file" if you need help doing so.
- In your Content Service services/odata-v4-framework/ folder, overwrite the existing discovery-lightweight-client.jar with the new one you just created.
- Finally, go to the location of each of your other Content Delivery microservices in turn (except the Discovery Service), and in each one, overwrite the file services/odata-v4-framework/discovery-lightweight-client.jar with your new JAR file.