The haOverflow example has a CacheServer
that allows HA queue overflow. The server starts with
that eviction of the client HA queues is based on the number of entries. Other options for
this parameter include
mem, or memory, which means the queue eviction is based on the
memory/size of the client HA queue.
Available specifications for this parameter are as follows :
noneimplying no overflow
memimplying memory-based overflow, threshold in MB
entryimplying entry-based overflow, threshold as number of entries
The capacity parameter dictates the queue capacity, before the queue is faulted to
the disk. It should be set to "Number of Entries" for policy as
entry, and "Memory size in MB"
mem eviction. The disk directory for overflow is specified with the
overflow-directory parameter, and is set to
$CWD/backupDirectory. You can check the contents of this overflow directory as the example executes.
haOverflow example is located in the GemFire installation under
Start two terminal sessions, or shells. In each shell, configure your environment according to the instructions provided in examples/EnvSetup.html.
Once your environment is set, change to the
directory in both shells to run the application. You may wish to configure the example
to run with non-default connection properties (to use a unique mcast-port,
for example). To do this, change the
The application takes a cache server configuration file in input. You can use the example
configuration files provided in the example directory, or you can create and test your own.
This sample uses
examples/haOverflow/server.xml file for
Start the server in one shell using this command, entered on a single line:
java -DgemfirePropertyFile=server_gemfire.properties haOverflow.HACacheServer server.xml
Once started, the server waits for clients to connect. It is set up to create an overflow for
HA event queues that can include
put events, for example.
The following examples guide you through a simple exercise using entry overflow,
but you are encouraged to try your own.
Running the Durable Client Manager to simulate an event downflow
HADurableClientMgr in the other shell using this command, entered on a single line:
java -DgemfirePropertyFile=client_gemfire.properties haOverflow.HADurableClientMgr client.xml
HADurableClientMgr example runs three cache clients sequentially in the same distributed system.
The cache clients define the same cache region, which is a root region named
The first cache client is a durable client, which registers with the server and disconnects
keepalive option. This in effect lets the server keep the event queues for the durable
client open. The default timeout for the queues is 300 seconds.
Subsequently, the second cache client connects and feeds data into the
root region. This
data population gets events populated in the queues for the durable clients. The queue overflows
to the disk once the threshold set earlier in the server is breached.
Finally, the third cache client connects and starts the durable client again. This causes the server to fetch all applicable events from the disk and flush them to the client.
To end this example, press
CTRL-C in the server and client shells, then enter
exit in both shells to close them.
Optionally, you can start
HAFeederClient, each in a separate shell, and have more control over when the overflow happens.
Running the Durable Client
To try out
HADurableClient with these configuration files, run:
java -DgemfirePropertyFile=durable_client_gemfire.properties haOverflow.HADurableClient client.xml
To try out
HAFeederClient with these configuration files, run:
java -DgemfirePropertyFile=client_gemfire.properties haOverflow.HAFeederClient client.xml
This starts the cache client and initializes their caches.