Hi Liquan. You should configure your AEQ the same on all cache servers. If you are using a replicated region, GemFire will only start the AEQ on one host and will have a secondary waiting on the other host in case of failure. The events will only fire on the 'primary' AEQ. GemFire will take care of switching to a secondary in case of a failure on the primary.
AsyncEventQueue configuration for replicated region in peer servers
We have 2 peer cache servers and a replicated region. Now we want to setup an AsynEventListener for write-behind behavior. This is not in WAN topology yet.
So should we use the same configuration for both cache servers?
1. If we use the same configuration for both cache servers, how the two AsyncEventQueue will coordinate with each other? If client sent an update event, will both queue have the same event? will both AsyncEventListener try to update DB? How's the replication carrying out?
- If we need to set up one AsynEventListener in one of the cache server. What if that cache server is down? we will lose the capabilities of write behind?
Please sign in to leave a comment.
To follow on Jens response, you can use the same configuration for both servers. With replicated regions, you have to use the serial async event queue. This means that one of the peers queues will be primary; the other secondary. Both queues get all the events, but only the primary processes those events. For serial async event queues, the replication is between the queues, so there will be a performance penalty when you add these queues. If you only configure one async event queue, any events that happen after the server crashes will not be processed by the queue. If the queue is persistent, any events that had already been queued will be processed when the server is restarted.
Configure your cache servers something like this:
<async-event-queue id="db_queue" parallel="false" dispatcher-threads="5" disk-store-name="db_queue_store">
<disk-store name="db_queue_store" max-oplog-size="10"> <disk-dirs> <disk-dir>.</disk-dir> </disk-dirs> </disk-store>
<region name="data" refid="REPLICATE">
Many thanks Jens and Barry for your prompt help. I especially like the switching details that Barry mentioned.