From bd12999c74c4f059294bbdad3284e24d4df623e5 Mon Sep 17 00:00:00 2001 From: Keith Wall Date: Sat, 2 Jun 2012 11:11:57 +0000 Subject: QPID-4006: [Java Broker] Docbook documentation for BDB HA (first version) Applied patch from Oleksandr Rudyy and myself. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1345487 13f79535-47bb-0310-9956-ffa450edef68 --- .../AMQP-Messaging-Broker-Java-Book.xml | 3 +- doc/book/src/java-broker/HA-Guide.xml | 937 +++++++++++++++++++++ doc/book/src/java-broker/images/HA-2N-Key.png | Bin 0 -> 25912 bytes doc/book/src/java-broker/images/HA-2N-Key.svg | 3 + .../src/java-broker/images/HA-2N-MasterFail.png | Bin 0 -> 200842 bytes .../src/java-broker/images/HA-2N-MasterFail.svg | 3 + .../java-broker/images/HA-2N-NetworkPartition.png | Bin 0 -> 159519 bytes .../java-broker/images/HA-2N-NetworkPartition.svg | 3 + doc/book/src/java-broker/images/HA-2N-Normal.png | Bin 0 -> 42088 bytes doc/book/src/java-broker/images/HA-2N-Normal.svg | 3 + .../src/java-broker/images/HA-2N-ReplicaFail.png | Bin 0 -> 162077 bytes .../src/java-broker/images/HA-2N-ReplicaFail.svg | 3 + .../src/java-broker/images/HA-2N-SplitBrain.png | Bin 0 -> 130546 bytes .../src/java-broker/images/HA-2N-SplitBrain.svg | 3 + .../images/HA-BDBHAMessageStore-MBean-jconsole.png | Bin 0 -> 81500 bytes .../java-broker/images/HA-perftests-results.png | Bin 0 -> 29998 bytes 16 files changed, 957 insertions(+), 1 deletion(-) create mode 100644 doc/book/src/java-broker/HA-Guide.xml create mode 100644 doc/book/src/java-broker/images/HA-2N-Key.png create mode 100644 doc/book/src/java-broker/images/HA-2N-Key.svg create mode 100644 doc/book/src/java-broker/images/HA-2N-MasterFail.png create mode 100644 doc/book/src/java-broker/images/HA-2N-MasterFail.svg create mode 100644 doc/book/src/java-broker/images/HA-2N-NetworkPartition.png create mode 100644 doc/book/src/java-broker/images/HA-2N-NetworkPartition.svg create mode 100644 doc/book/src/java-broker/images/HA-2N-Normal.png create mode 100644 doc/book/src/java-broker/images/HA-2N-Normal.svg create mode 100644 doc/book/src/java-broker/images/HA-2N-ReplicaFail.png create mode 100644 doc/book/src/java-broker/images/HA-2N-ReplicaFail.svg create mode 100644 doc/book/src/java-broker/images/HA-2N-SplitBrain.png create mode 100644 doc/book/src/java-broker/images/HA-2N-SplitBrain.svg create mode 100644 doc/book/src/java-broker/images/HA-BDBHAMessageStore-MBean-jconsole.png create mode 100644 doc/book/src/java-broker/images/HA-perftests-results.png (limited to 'doc') diff --git a/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml b/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml index 0bb40052cd..73240a81cb 100644 --- a/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml +++ b/doc/book/src/java-broker/AMQP-Messaging-Broker-Java-Book.xml @@ -31,7 +31,7 @@ Implemented in Java - Fully JMS compliant, runs on any Java platform. - Both AMQP messaging brokers support clients in multiple languages, as long as the messaging client and the messaging broker use the same version of AMQP. See to see which messaging clients work with each broker. + Both AMQP messaging brokers support clients in multiple languages, as long as the messaging client and the messaging broker use the same version of AMQP. This manual contains information specific to the broker that is implemented in Java. @@ -44,6 +44,7 @@ + diff --git a/doc/book/src/java-broker/HA-Guide.xml b/doc/book/src/java-broker/HA-Guide.xml new file mode 100644 index 0000000000..1c9ea078e1 --- /dev/null +++ b/doc/book/src/java-broker/HA-Guide.xml @@ -0,0 +1,937 @@ + + + + + +]> + +
+ High Availability +
+ General Introduction + The term High Availability (HA) usually refers to having a number of instances of a service such as a Message Broker + available so that should a service unexpectedly fail, or requires to be shutdown for maintenance, users may quickly connect + to another instance and continue their work with minimal interuption. HA is one way to make a overall system more resilient + by eliminating a single point failure from a system. + HA offerings are usually categorised as Active/Active or Active/Passive. + An Active/Active system is one where all nodes within the cluster are usuaully available for use by clients all of the time. In an + Active/Passive system, one only node within the clsuter is available for use by clients at any one time, whilst the others are in + some kind of standby state, awaiting to quickly step-in in the event the active node becomes unavailable. + +
+
+ HA offerings of the Java Broker + The Java Broker's HA offering became available at release 0.18. HA is provided by way of the HA + features built into the Java Edition of the Berkley Database (BDB JE) and as such + is currently available to to Java Broker users who use the BDB Store. + HA in the Java Broker provides an Active/Passive mode of operation with Virtual hosts being + the unit of replication. The Active node (referred to as the Master) accepts all work from all the clients. + The Passive nodes (referred to as Replicas) are unavailable for work: the only task they must perform is + to remain in synch with the Master node by consuming a replication stream containing all data and state. + If the Master node fails, a Replica node is elected to become the new Master node. All clients automatically failover + The automatic failover feature is available only for AMQP connections from the Java client. Management connections (JMX) + do not current offer this feature. to the new Master and continue their work. + The Java Broker HA solution is incompatible with the HA solution offered by the CPP Broker. It is not possible to co-locate Java and CPP + Brokers within the same cluster. + HA is not currently available for those using the the Derby Store or Memory + Message Store. +
+
+ Two Node Cluster +
+ Overview + In this HA solution, a cluster is formed with two nodes. one node serves as + master and the other is a replica. + + All data and state required for the operation of the virtual host is automatically sent from the + master to the replica. This is called the replication stream. The master virtual host confirms each + message is on the replica before the client transaction completes. The exact way the client awaits + for the master and replica is gorverned by the durability + configuration, which is discussed later. In this way, the replica remains ready to take over the + role of the master if the master becomes unavailable. + + It is important to note that there is an inherent limitation of two node clusters is that + the replica node cannot make itself master automatically in the event of master failure. This + is because the replica has no way to distinguish between a network partition (with potentially + the master still alive on the other side of the partition) and the case of genuine master failure. + (If the replica were to elect itself as master, the cluster would run the risk of a + split-brain scenario). + In the event of a master failure, a third party must designate the replica as primary. This process + is described in more detail later. + + Clients connect to the cluster using a failover url. + This allows the client to maintain a connection to the master in a way that is transparent + to the client application. +
+
+ Depictions of cluster operation + In this section, the operation of the cluster is depicted through a series of figures + supported by explanatory text. +
+ Key for figures + + + + + + Key to figures + + +
+
+ Normal Operation + The figure below illustrates normal operation. Clients connecting to the cluster by way + of the failover over URL achieve a connection to the master. A clients perform work (message + production, consumption, queue creation etc), the master additionally sends this data to the + replica over the network. +
+ Normal operation of a two-node cluster + + + + + + Normal operation + + +
+
+
+ Master Failure and Recovery + The figure below illustrates a sequence of events whereby the master suffers a failure + and the replica is made the master to allow the clients to continue to work. Later the + old master is repaired and comes back on-line in replica role. + The item numbers in this list apply to the numbered boxes in the figure below. + + + System operating normally + + + Master suffers a failure and disconnects all clients. Replica realises that it is no + longer in contact with master. Clients begin to try to reconnect to the cluster although these + connection attempts will fail at this point. + + + A third-party (an operator, a script or a combination of the two) verifies that the master has truely + failed. If it has truely failed, the decision is made to designate the replica as primary. + This primary designation is performed using JMX. + + + Client connections to the new master succeed and the service is restored + , albeit without a replica. + + + The old master is repaired and brought back on-line. It automatically rejoins the cluster + in the replica role. + + +
+ Failure of master and recovery sequence + + + + + + Failure of master and subsequent recovery sequence + + +
+
+
+ Replica Failure and Recovery + The figure that follows illustrates a sequence of events whereby the replica suffers a failure + leaving the master to continue processing alone. Later the replica is repaired and is restarted. + It rejoins the cluster so that it is once again ready to take over in the event of master failure. + The behavior of the replica failure case is governed by the designatedPrimary + configuration item. If true on the master, the master will continue to operate solo without outside + intervention. If false, a third-party must designate as primary in order for the master to continue solo. + The item numbers in this list apply to the numbered boxes in the figure below. This example assumes + that designatedPrimary is true. + + + System operating normally + + + Replica suffers a failure. Master realises that replica longer in contact but as + designatedPrimary is true, master continues processing solo thus client + connections are uninterrupted by the loss of the replica. System operating normally albeit with + single node. + + + Replica is repaired. + + + After catching up with missed work, replica is once again ready to take over in the event of master failure. + + +
+ Failure of replica and subsequent recovery sequence + + + + + + Failure of replica and subsequent recovery sequence + + +
+
+
+ Network Partition and Recovery + The figure below illustrates the sequence of events that would occur if the network between + master and replica were to suffer a partition, and the nodes were out of contact with one and other. + As with Replica Failure and Recovery, the + behaviour is governed by the designatedPrimary. + Only if designatedPrimary is true on the master, wil the master continue solo. + The item numbers in this list apply to the numbered boxes in the figure below. This example assumes + that designatedPrimary is true. + + + System operating normally + + + Network suffers a failure. Master realises that replica longer in contact but as + designatedPrimary is true, master continues processing solo thus client + connections are uninterrupted by the network partition. + + + Network is repaired. + + + After catching up with missed work, replica is once again ready to take over in the event of master failure. + System operating normally again. + + +
+ Partition of the network separating master and replica + + + + + + Network Partition and Recovery + + +
+
+
+ Split Brain + A split-brain + is a situation where the two node cluster has two masters. BDB normal strives to prevent + this situation arising by preventing two nodes in a cluster being master at the same time. + However, if the network suffers a partition, and the third-party intervenes incorrectly + and makes the replica a second master a split-brain will be formed and both masters will + proceed to perform work independently of one and other. + There is no automatic recovery from a split-brain. + Manual intervention will be required to choose which store will be retained as master + and which will be discarded. Manual intervention will be required to identify and repeat the + lost business transactions. + The item numbers in this list apply to the numbered boxes in the figure below. + + + System operating normally + + + Network suffers a failure. Master realises that replica longer in contact but as + designatedPrimary is true, master continues processing solo. Client + connections are uninterrupted by the network partition. + A third-party erroneously designates the replica as primary. + + + As the nodes cannot see one and other, both behave as masters. Clients perform work against + both master nodes. + + +
+ Split Brain + + + + + + Split Brain + + +
+
+
+
+
+ Multi Node Cluster + Multi node clusters, that is clusters where the number of nodes is three or more, are not yet + ready for use. +
+
+ Configuring a Virtual Host to be a node + To configure a virtualhost as a cluster node, configure the virtualhost.xml in the following manner: + + + myhost + + + org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore + ${work}/bdbhastore + + myclustername + mynode1 + node1host:port + node1host:port + NO_SYNC\,NO_SYNC\,SIMPLE_MAJORITY + true|false + true|false + + + ... + +]]> + + The groupName is the name of logical name of the cluster. All nodes within the + cluster must use the same groupName in order to be consider part of the cluster. + The nodeName is the logical name of the node. All nodes within the cluster must have a + unique name. It is recommended that the node name should be chosen from a different nomenclature from that of + the servers on which they are hosted, in case the need arises to move node to a new server in the future. + The nodeHostPort is the hostname and port number used by this node to communicate with the + the other nodes in the cluster. For the hostname, an IP address, hostname or fully qualified hostname may be used. + For the port number, any free port can be used. It is important that this address is stable over time, as BDB + records and uses this address internally. + The helperHostPort is the hostname and port number that new nodes use to discover other + nodes within the cluster when they are newly introduced to the cluster. When configuring the first node, set the + helperHostPort to its own nodeHostPort. For the second and subsequent nodes, + set their helperHostPort to that of of the first node. + durability controls the durability + guarantees made by the cluster. It is important that all nodes use the same value. The default value is + NO_SYNC\,NO_SYNC\,SIMPLE_MAJORITY. Owning to the internal use of Apache Commons Config, it is necessary + to escape the commas within the durability string. + coalescingSync controls the coalescing-sync + mode of Qpid. It is important that all nodes use the same value. If omitted, it defaults to true. + The designatedPrimary is applicable only to the two-node + case. It governs the behaviour of the master node when the replica fails or becomes uncontactable. If true, + the master will automatically designate itself as primary and service will continue from the single node. If false, + the master will transition to an unavailable state until a third-party manually designates the node as primary + or the replica is restored. It is suggested that the node that normally fulfils the role of master is set true in + config file and the node that is normally replica is set false. Be aware that setting both nodes to true will lead + to a split-brain in the case of network partition. +
+ Passing BDB environment and replication configuration options + It is possible to pass BDB + environment and + replication configuration options from the virtualhost.xml. Environment configuration options are passed using + the envConfig element, and replication config using repConfig. + For example, to override the BDB environment configuration options je.cleaner.threads and + je.txn.timeout + + + je.cleaner.threads + 2 + + + je.txn.timeout + 15 min + + ... + ]]> + And to override the BDB replication configuration options je.rep.insufficientReplicasTimeout. + + ... + + je.rep.insufficientReplicasTimeout + 2 + + + je.txn.timeout + 10 s + + ... + ]]> +
+
+
+ Durability Guarantees + The term durability is used to mean that once a + transaction is committed, it remains committed regardless of subsequent failures. A highly durable system is one where + loss of a committed transaction is extermely unlikely, whereas with a less durable system loss of a transaction is likely + in a greater number of scenarios. Typically, the more highly durable a system the slower and more costly it will be. + Qpid exposes the all the + durability controls + offered by by BDB JE JA and a Qpid specific optimisation called coalescing-sync which defaults + to enabled. +
+ BDB Durability Controls + BDB expresses durability as a triplet with the following form: + ,,]]> + The sync polices controls whether the thread performing the committing thread awaits the successful completion of the + write, or the write and sync before continuing. The master sync policy and replica sync policy need not be the same. + For master and replic sync policies, the available values are: + SYNC, + WRITE_NO_SYNC, + NO_SYNC. SYNC + is offers the highest durability whereas NO_SYNC the lowest. + Note: the combination of a master sync policy of SYNC and coalescing-sync + true would result in poor performance with no corresponding increase in durability guarantee. It cannot not be used. + The acknowledgement policy defines whether when a master commits a transaction, it also awaits for the replica(s) to + commit the same transaction before continuing. For the two-node case, ALL and SIMPLE_MAJORITY are equal. + For acknowledgement policy, the available value are: + ALL, + SIMPLE_MAJORITY + NONE. +
+
+ Coalescing-sync + If enabled (the default) Qpid works to reduce the number of separate + file-system sync operations + performed by the master on the underlying storage device thus improving performance. It does + this coalescing separate sync operations arising from the different client commits operations occuring at approximately the same time. + It does this in such a manner not to reduce the ACID guarantees of the system. + Coalescing-sync has no effect on the behaviour of the replicas. +
+
+ Default + The default durability guarantee is NO_SYNC, NO_SYNC, SIMPLE_MAJORITY with coalescing-sync enabled. The effect + of this combination is described in the table below. It offers a good compromise between durability guarantee and performance + with writes being guaranteed on the master and the additional guarantee that a majority of replicas have received the + transaction. +
+
+ Examples + Here are some examples illustrating the effects of the durability and coalescing-sync settings. + + + Effect of different durability guarantees + + + + + Durability + Coalescing-sync + Description + + + + + 1 + NO_SYNC, NO_SYNC, SIMPLE_MAJORITY + true + Before the commit returns to the client, the transaction will be written/sync'd to the Master's disk (effect of + coalescing-sync) and a majority of the replica(s) will have acknowledged the receipt + of the transaction. The replicas will write and sync the transaction to their disk at a point in the future governed by + ReplicationMutableConfig#LOG_FLUSH_INTERVAL. + + + + 2 + NO_SYNC, WRITE_NO_SYNC, SIMPLE_MAJORITY + true + Before the commit returns to the client, the transaction will be written/sync'd to the Master's disk (effect of + coalescing-sync and a majority of the replica(s) will have acknowledged the write of + the transaction to their disk. The replicas will sync the transaction to disk at a point in the future governed by + ReplicationMutableConfig#LOG_FLUSH_INTERVAL. + + + 3 + NO_SYNC, NO_SYNC, NONE + false + After the commit returns to the client, the transaction is neither guaranteed to be written to the disk of the master + nor received by any of the replicas. The master and replicas will write and sync the transaction to their disk at a point + in the future governed by ReplicationMutableConfig#LOG_FLUSH_INTERVAL. This offers the weakest durability guarantee. + + + +
+
+
+
+
+ Client failover configuration + The details about format of Qpid connection URLs can be found at section + Connection URLs + of book Programming In Apache Qpid. + The failover policy option in connection URL for HA Cluster should be set to roundrobin. + The Master broker should be put into a first place in brokerlist URL option. + The recommended value for connectdelay option in broker URL should be set to + the value greater than 1000 milliseconds. If it is desired that clients re-connect automatically after a + master to replica failure, cyclecount should be tuned so that the retry period is longer than + the expected length of time to perform the failover. + Example of connection URL for the HA Cluster +
+
+ Qpid JMX API for HA + Qpid exposes HA store information via JMX interface and provides JMX API to remove Node from the group, update Node IP address + and assign Node as a designated primary. + MBean BDBHAMessageStore is instantiated by the Qpid broker for the each instance of HA store. + The reference to this MBean can be obtained via JMX API using object name like org.apache.qpid:type=BDBHAMessageStore,name=<host name> + where <host name> is the name of the virtual host of the broker. + + Mbean <classname>BDBHAMessageStore</classname> attributes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAccessibilityDescription
GroupNameStringRead onlyName identifying the group
NodeNameStringRead onlyUnique name identifying the node within the group
NodeHostPortStringRead onlyHost/port used to replicate data between this node and others in the group
HelperHostPortStringRead onlyHost/port used to allow a new node to discover other group members
NodeStateStringRead onlyCurrent state of the node
ReplicationPolicyStringRead onlyNode replication durability
DesignatedPrimarybooleanRead/WriteDesignated primary flag. Applicable to the two node case.
getAllNodesInGroupTabularDataRead onlyGet all nodes within the group, regardless of whether currently attached or not
+ + Mbean <classname>BDBHAMessageStore</classname> operations + + + + + + + + + + + + + + + + + + + + + + +
OperationParametersReturnsDescription
removeNodeFromGroup + nodeName, name of node, string + voidRemove an existing node from the group
updateAddress + + + nodeName, name of node, string + + + newHostName, new host name, string + + + newPort, new port number, int + + + voidUpdate the address of another node. The node must be in a STOPPED state.
+
+ BDBHAMessageStore view from jconsole. + +
+ + Example of java code to get the node state value + environment = new HashMap(); + +// credentials: user name and password +environment.put(JMXConnector.CREDENTIALS, new String[] {"admin","admin"}); +JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:9001/jmxrmi"); +JMXConnector jmxConnector = JMXConnectorFactory.connect(url, environment); +MBeanServerConnection mbsc = jmxConnector.getMBeanServerConnection(); + +ObjectName queueObjectName = new ObjectName("org.apache.qpid:type=BDBHAMessageStore,name=test"); +String state = (String)mbsc.getAttribute(queueObjectName, "NodeState"); + +System.out.println("Node state:" + state); + ]]> + Example system output: + + +
+
+ Monitoring cluster + In order to discover the potential issues with HA Cluster early, all nodes in the Cluster should be monitored on regular basis + using the following techniques: + + + Broker log files scrapping for WARN or ERROR entries and operational log entries like: + + + MST-1007 : Store Passivated. It can indicate that Master virtual host is down. + + + MST-1006 : Recovery Complete. It can indicate that former Replica virtual host is up and became Master. + + + + + Disk space usage and system load using system tools. + + + Berkeley HA node status using DbPing utility. + Using <classname>DbPing</classname> utility for monitoring HA nodes. +Current state of node: Node-5001 from group: TestClusterGroup + Current state: MASTER + Current master: Node-5001 + Current JE version: 5.0.48 + Current log version: 8 + Current transaction end (abort or commit) VLSN: 165 + Current master transaction end (abort or commit) VLSN: 0 + Current active feeders on node: 0 + Current system load average: 0.35 + + In the example above DbPing utility requested status of Cluster node with name + Node-5001 from replication group TestClusterGroup running on host localhost:5001. + The state of the node was reported into a system output. + + + + Using Qpid broker JMX interfaces. + Mbean BDBHAMessageStore can be used to request the following node information: + + + NodeState indicates whether node is a Master or Replica. + + + Durability replication durability. + + + DesignatedPrimary indicates whether Master node is designated primary. + + + GroupName replication group name. + + + NodeName node name. + + + NodeHostPort node host and port. + + + HelperHostPort helper host and port. + + + AllNodesInGroup lists of all nodes in the replication group including their names, hosts and ports. + + + For more details about BDBHAMessageStore MBean please refer section Qpid JMX API for HA + + +
+
+ Disk space requirements + Disk space is a critical resource for the HA Qpid broker. + In case when Replica goes down (or falls behind the Master in 2 node cluster where Master is designated primary) + and Master continues running, the non-replicated logs are stored on a Master disk for the period of time + as specified in je.rep.repStreamTimeout JE setting in order to replicate this data later + when Replica is back. This setting is set to 1 hour by default on QPid broker. The setting can be overridden as described + . + Depending from the application publishing/consuming rates and message sizes, + the disk space might become overfull during this period of time due to preserved logs. + Please, make sure to allocate enough space on your disk to avoid this from happening. + +
+
+ Network Requirements + The HA Cluster performance depends from the network bandwidth, its load by existing traffic and quality of service. + In order to achieve a better performance it is recommended to use a separate network infrastructure for the Qpid HA Nodes + which might include installation of dedicated network hardware on Broker hosts, assigning a higher priority to replication ports, + installing a cluster in a separate network not impacted by any other traffic. +
+
+ Security + At the moment Berkeley replication API supports only TCP/IP protocol to transfer replication data between Master and Replicas. + As result, the replicated data is unprotected and can be intercepted by anyone having access to the replication network. + Also, anyone who can access to this network can introduce a new node and therefore receive a copy of the data. + In order to reduce the security risks the entire HA cluster is recommended to run in a separate network protected from general access. +
+
+ Backups + In order to protect the entire cluster from some cataclysms which might destroy all cluster nodes, + the backups of a Master store should be taken on a regular basis. + Qpid Broker distribution includes the "hot" backup utility backup.sh which can be found at broker bin folder. + This utility can perform the backup when broker is running. + backup.sh script invokes org.apache.qpid.server.store.berkeleydb.BDBBackup to do the job. + You can also run this class from command line like in an example below: + Performing store backup by using <classname>BDBBackup</classname> class directly + java -cp qpid-bdbstore-0.18.jar org.apache.qpid.server.store.berkeleydb.BDBBackup -fromdir path/to/store/folder -todir path/to/backup/folder + + In the example above BDBBackup utility is called from qpid-bdbstore-0.18.jar to backup the store at path/to/store/folder and copy store logs into path/to/backup/folder. + Linux and Unix users can take advantage of backup.sh bash script by running this script in a similar way. + Performing store backup by using <classname>backup.sh</classname> bash script + backup.sh -fromdir path/to/store/folder -todir path/to/backup/folder + + + Please, do not forget to switch to do backups of a new Master store when cluster Master is changed. + +
+
+ Migration of a non-HA store to HA + Non HA stores starting from schema version 4 (0.14 Qpid release) can be automatically converted into HA store on broker startup if replication is previously enabled with DbEnableReplication utility from Berkeley JE jar. + DbEnableReplication converts non HA store into HA store and can be used as follows: + Enabling replication + In the examples above, je jar of version 5.0.48 is used to convert store at /path/to/store into HA store having replication group name MyReplicationGroup, node name MyNode1 and running on host localhost and port 5001. + After running DbEnableReplication and changing virtual host store to HA message store, like in example below, on broker start up the store schema will be upgraded to the recent version and broker can be used as normal. + + Example of XML configuration for HA message store + + org.apache.qpid.server.store.berkeleydb.BDBHAMessageStore + /path/to/store + + MyReplicationGroup + MyNode1 + localhost:5001 + localhost:5001 + +]]> + + The Replica nodes can be started with empty stores. The data will be automatically copied from Master to Replica on Replica start-up. + + Due to existing caveats in Berkeley JE with copying of data from Master into Replica it is recommended to restart the Master node after store schema upgrade is finished before starting the Replica nodes. + +
+
+ Performance + The aim of this section is not providing Qpid broker performance metrics for HA as it depends from the test environment but rather showing an impact of HA on Qpid Broker performance in comparison with Non HA case. + For testing of impact of HA on a broker performance a special test script was written using Qpid performance test framework. + The script opened a number of connections to the Qpid broker, created producers and consumers on separate connections, + and published test messages with concurrent producers into a test queue and consumed them with concurrent consumers. + The table below shows the number of producers/consumers used in the tests. + The overall throughput was collected for each of the number. + + + Number of producers/consumers in performance tests + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TestNumber of producersNumber of consumers
111
222
344
488
51616
63232
76464
+ The test was run against the following Qpid Brokers + + + Non HA Broker + + + HA 2 Nodes Cluster with durability SYNC,SYNC,ALL + + + HA 2 Nodes Cluster with durability WRITE_NO_SYNC,WRITE_NO_SYNC,ALL + + + HA 2 Nodes Cluster with durability WRITE_NO_SYNC,WRITE_NO_SYNC,ALL and coalescing-sync Qpid mode + + + HA 2 Nodes Cluster with durability WRITE_NO_SYNC,NO_SYNC,ALL and coalescing-sync Qpid mode + + + HA 2 Nodes Cluster with durability NO_SYNC,NO_SYNC,ALL and coalescing-sync Qpid option + + + Test Environment we tested performance on was not really representative as we got only 2 test servers + having 4core processors Intel(r) Xeon(R) CPU 5150@2.66GHz, 4G of RAM + and running under OS Red Hat Enterprise Linux AS release 4 (Nahant Update 4). + Network bandwidth was 1Mbit. + + We ran Master node on a first server and Replica and clients(both consumers and producers) on a second server. + In non-HA case Qpid Broker was run on a first server and clients were run on a second server. + The table below contains the test results we measured on this environment for different Broker configurations. + Each result is represented by throughput value in KB/second and difference in % between HA configuration and non HA case for the same number of clients. + + Performance Comparison + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Test/BrokerNo HASYNC, SYNC, ALLWRITE_NO_SYNC, WRITE_NO_SYNC, ALLWRITE_NO_SYNC, WRITE_NO_SYNC, ALL - coalescing-syncWRITE_NO_SYNC, NO_SYNC,ALL - coalescing-syncNO_SYNC, NO_SYNC, ALL - coalescing-sync
1 (1/1)0.0%-61.4%117.0%-16.02%-9.58%-25.47%
2 (2/2)0.0%-75.43%67.87%-66.6%-69.02%-30.43%
3 (4/4)0.0%-84.89%24.19%-71.02%-69.37%-43.67%
4 (8/8)0.0%-91.17%-22.97%-82.32%-83.42%-55.5%
5 (16/16)0.0%-91.16%-21.42%-86.6%-86.37%-46.99%
6 (32/32)0.0%-94.83%-51.51%-92.15%-92.02%-57.59%
7 (64/64)0.0%-94.2%-41.84%-89.55%-89.55%-50.54%
+ The figure below depicts the graphs for the performance test results +
+ Test results + +
+ On using durability SYNC,SYNC,ALL (without coalescing-sync) the performance drops significantly (by 62-95%) in comparison with non HA broker. + Whilst, on using durability WRITE_NO_SYNC,WRITE_NO_SYNC,ALL (without coalescing-sync) the performance drops by only half, but with loss of durability guarantee, so is not recommended. + In order to have better performance with HA, Qpid Broker comes up with the special mode called coalescing-sync, + With this mode enabled, Qpid broker batches the concurrent transaction commits and syncs transaction data into Master disk in one go. + As result, the HA performance only drops by 25-60% for durability NO_SYNC,NO_SYNC,ALL and by 10-90% for WRITE_NO_SYNC,WRITE_NO_SYNC,ALL. +
+
diff --git a/doc/book/src/java-broker/images/HA-2N-Key.png b/doc/book/src/java-broker/images/HA-2N-Key.png new file mode 100644 index 0000000000..3c1856d496 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-Key.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-Key.svg b/doc/book/src/java-broker/images/HA-2N-Key.svg new file mode 100644 index 0000000000..9567f385d5 --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-Key.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 7Layer 1BrokerClientClusterVirtualhostReplicationstreamClientconnectionRepairFaultDesignatePrimary diff --git a/doc/book/src/java-broker/images/HA-2N-MasterFail.png b/doc/book/src/java-broker/images/HA-2N-MasterFail.png new file mode 100644 index 0000000000..b839d291b9 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-MasterFail.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-MasterFail.svg b/doc/book/src/java-broker/images/HA-2N-MasterFail.svg new file mode 100644 index 0000000000..35b2c643ff --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-MasterFail.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 2Layer 112453 diff --git a/doc/book/src/java-broker/images/HA-2N-NetworkPartition.png b/doc/book/src/java-broker/images/HA-2N-NetworkPartition.png new file mode 100644 index 0000000000..cd4a196924 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-NetworkPartition.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-NetworkPartition.svg b/doc/book/src/java-broker/images/HA-2N-NetworkPartition.svg new file mode 100644 index 0000000000..375d88a7db --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-NetworkPartition.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 5Layer 1124133 diff --git a/doc/book/src/java-broker/images/HA-2N-Normal.png b/doc/book/src/java-broker/images/HA-2N-Normal.png new file mode 100644 index 0000000000..eeaad4f230 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-Normal.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-Normal.svg b/doc/book/src/java-broker/images/HA-2N-Normal.svg new file mode 100644 index 0000000000..c4fac9d37a --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-Normal.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 1Layer 1 diff --git a/doc/book/src/java-broker/images/HA-2N-ReplicaFail.png b/doc/book/src/java-broker/images/HA-2N-ReplicaFail.png new file mode 100644 index 0000000000..769fc959fc Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-ReplicaFail.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-ReplicaFail.svg b/doc/book/src/java-broker/images/HA-2N-ReplicaFail.svg new file mode 100644 index 0000000000..aa872a30e3 --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-ReplicaFail.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 4Layer 12134 diff --git a/doc/book/src/java-broker/images/HA-2N-SplitBrain.png b/doc/book/src/java-broker/images/HA-2N-SplitBrain.png new file mode 100644 index 0000000000..74393648a5 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-2N-SplitBrain.png differ diff --git a/doc/book/src/java-broker/images/HA-2N-SplitBrain.svg b/doc/book/src/java-broker/images/HA-2N-SplitBrain.svg new file mode 100644 index 0000000000..c82cc5065a --- /dev/null +++ b/doc/book/src/java-broker/images/HA-2N-SplitBrain.svg @@ -0,0 +1,3 @@ + + +2012-05-31 06:19ZCanvas 6Layer 1213 diff --git a/doc/book/src/java-broker/images/HA-BDBHAMessageStore-MBean-jconsole.png b/doc/book/src/java-broker/images/HA-BDBHAMessageStore-MBean-jconsole.png new file mode 100644 index 0000000000..b2d52575bb Binary files /dev/null and b/doc/book/src/java-broker/images/HA-BDBHAMessageStore-MBean-jconsole.png differ diff --git a/doc/book/src/java-broker/images/HA-perftests-results.png b/doc/book/src/java-broker/images/HA-perftests-results.png new file mode 100644 index 0000000000..e8dbb3c123 Binary files /dev/null and b/doc/book/src/java-broker/images/HA-perftests-results.png differ -- cgit v1.2.1