Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
334 additions
and
308 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
documentation/src/main/asciidoc/stories/assembly_cache_store_implementations.adoc
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
documentation/src/main/asciidoc/stories/assembly_cache_stores.adoc
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
documentation/src/main/asciidoc/stories/assembly_creating_custom_cache_stores.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
documentation/src/main/asciidoc/topics/code_examples/ConfigSingleFileStore.java
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
documentation/src/main/asciidoc/topics/code_examples/ConfigSingleFileStoreRemote.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
documentation/src/main/asciidoc/topics/code_examples/ConfigSoftIndexFileStore.java
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
documentation/src/main/asciidoc/topics/code_examples/GlobalPersistentLocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
new GlobalConfigurationBuilder().globalState().enable().persistentLocation("example", "my.data"); |
76 changes: 76 additions & 0 deletions
76
documentation/src/main/asciidoc/topics/con_file_based_cache_stores.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
[id='file-stores_{context}'] | ||
= File-Based Cache Stores | ||
|
||
File-based cache stores provide persistent storage on the local host filesystem where {brandname} is running. | ||
For clustered caches, file-based cache stores are unique to each {brandname} node. | ||
|
||
[WARNING] | ||
==== | ||
Never use filesystem-based cache stores on shared file systems, such as an NFS or Samba share, because they do not provide file locking capabilities and data corruption can occur. | ||
Additionally if you attempt to use transactional caches with shared file systems, unrecoverable failures can happen when writing to files during the commit phase. | ||
==== | ||
|
||
[discrete] | ||
== Soft-Index File Stores | ||
|
||
`SoftIndexFileStore` is the default implementation for file-based cache stores and stores data in a set of append-only files. | ||
|
||
When append-only files: | ||
|
||
* Reach their maximum size, {brandname} creates a new file and starts writing to it. | ||
* Reach the compaction threshold of less than 50% usage, {brandname} overwrites the entries to a new file and then deletes the old file. | ||
|
||
.B+ trees | ||
|
||
To improve performance, append-only files in a `SoftIndexFileStore` are indexed using a **B+ Tree** that can be stored both on disk and in memory. | ||
The in-memory index uses Java soft references to ensure it can be rebuilt if removed by Garbage Collection (GC) then requested again. | ||
|
||
Because `SoftIndexFileStore` uses Java soft references to keep indexes in memory, it helps prevent out-of-memory exceptions. | ||
GC removes indexes before they consume too much memory while still falling back to disk. | ||
|
||
You can configure any number of B+ trees. | ||
By default {brandname} creates up to 16 B+ trees, which means there can be up to 16 indexes. | ||
Having multiple indexes prevents bottlenecks from concurrent writes to an index. | ||
It also minimizes the number of entries that can be read at the same time because {brandname} reads all entries at the same time when it iterates over a soft-index file store. | ||
|
||
Each entry in the B+ tree is a node. | ||
By default, the size of each node is limited to 4096 bytes. | ||
`SoftIndexFileStore` throws an exception if keys are longer after serialization occurs. | ||
|
||
.Expired entries | ||
|
||
`SoftIndexFileStore` cannot detect expired entries, which can lead to excessive usage of space on the file system. | ||
|
||
.Segmentation | ||
|
||
Soft-index file stores are always segmented. | ||
|
||
[NOTE] | ||
==== | ||
The `AdvancedStore.purgeExpired()` method is not implemented in `SoftIndexFileStore`. | ||
==== | ||
|
||
[discrete] | ||
== Single File Cache Stores | ||
|
||
[NOTE] | ||
==== | ||
Single file cache stores are now deprecated and planned for removal. | ||
==== | ||
|
||
Single File cache stores, `SingleFileStore`, persist data to file. | ||
{brandname} also maintains an in-memory index of keys while keys and values are stored in the file. | ||
|
||
Because `SingleFileStore` keeps an in-memory index of keys and the location of values, it requires additional memory, depending on the key size and the number of keys. | ||
For this reason, `SingleFileStore` is not recommended for use cases where the keys are larger or there can be a larger number of them. | ||
|
||
In some cases, `SingleFileStore` can also become fragmented. | ||
If the size of values continually increases, available space in the single file is not used but the entry is appended to the end of the file. | ||
Available space in the file is used only if an entry can fit within it. | ||
Likewise, if you remove all entries from memory, the single file store does not decrease in size or become defragmented. | ||
|
||
.Segmentation | ||
|
||
Single file cache stores are segmented by default with a separate instance per segment, which results in multiple directories. | ||
Each directory is a number that represents the segment to which the data maps. |
16 changes: 0 additions & 16 deletions
16
documentation/src/main/asciidoc/topics/con_filesystem_cache_stores.adoc
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
documentation/src/main/asciidoc/topics/config_examples/global_persistent_location.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<cache-container default-cache="myCache"> | ||
<global-state> | ||
<persistent-location path="example" relative-to="my.data"/> | ||
</global-state> | ||
</cache-container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
documentation/src/main/asciidoc/topics/config_examples/persistence_single_file_store.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<persistence passivation="false"> | ||
<single-file-store shared="false" | ||
preload="true" | ||
fetch-state="true" | ||
read-only="false"/> | ||
</persistence> |
6 changes: 0 additions & 6 deletions
6
documentation/src/main/asciidoc/topics/config_examples/persistence_soft_index_file_store.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
documentation/src/main/asciidoc/topics/proc_configuring_file_stores.adoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
[id='configuring-file-stores_{context}'] | ||
= Configuring File-Based Cache Stores | ||
Add file-based cache stores to {brandname} to persist data on the host filesystem. | ||
|
||
.Prerequisites | ||
|
||
* Install {brandname} Server if you use remote caches. | ||
* Enable global state and configure a global persistent location if you use embedded caches. | ||
|
||
.Procedure | ||
|
||
. Add the `persistence` element to your cache configuration. | ||
. Optionally specify `true` as the value for the `passivation` attribute to write to the file-based cache store only when data is evicted from memory. | ||
. Include the `file-store` element and configure attributes as appropriate. | ||
. Specify `false` as the value for the `shared` attribute. | ||
+ | ||
File-based cache stores should always be unique to each {brandname} instance. | ||
If you want to use the same persistent across a cluster, configure shared storage such as a JDBC string-based cache store . | ||
+ | ||
. Configure the `index` and `data` elements to specify the location where {brandname} creates indexes and stores data. | ||
. Include the `write-behind` element to configure the cache store as write behind instead of as write through. | ||
|
||
.Directory location | ||
|
||
{brandname} creates file-based cache stores in the directory that you configure, relative to the global persistent location. | ||
For {brandname} this is the `{server_home}/server/data` directory. | ||
For embedded caches, {brandname} defaults to the `user.dir` system property. | ||
|
||
You should never configure an absolute path for a file-based cache store that is outside the global persistent location. | ||
If you do, {brandname} writes the following exception to logs: | ||
|
||
---- | ||
ISPN000558: "The store location 'foo' is not a child of the global persistent location 'bar'" | ||
---- | ||
|
||
.File-based cache store configuration | ||
[source,xml,options="nowrap",subs=attributes+] | ||
---- | ||
include::config_examples/persistence_file_store.xml[] | ||
---- |
Oops, something went wrong.