Commit 2ff9c063 authored by daryl herzmann's avatar daryl herzmann

Merge pull request #180 from tevans/OF-879

OF-879: Update hazelcast namespace, dependencies
parents 2778db9b dc97a815
......@@ -94,7 +94,7 @@ public class CacheFactory {
localCacheFactoryClass = JiveGlobals.getProperty(LOCAL_CACHE_PROPERTY_NAME,
"org.jivesoftware.util.cache.DefaultLocalCacheStrategy");
clusteredCacheFactoryClass = JiveGlobals.getProperty(CLUSTERED_CACHE_PROPERTY_NAME,
"com.jivesoftware.util.cache.ClusteredCacheFactory");
"org.jivesoftware.openfire.plugin.util.cache.ClusteredCacheFactory");
cacheNames.put("Favicon Hits", "faviconHits");
cacheNames.put("Favicon Misses", "faviconMisses");
......
......@@ -44,6 +44,13 @@
Hazelcast Clustering Plugin Changelog
</h1>
<p><b>2.0.0</b> -- February 6, 2015</p>
<p>Hazelcast update:</p>
<ul>
<li>Updated Hazelcast to latest release (3.4).</li>
<li>Repackaged to use Openfire's org.jivesoftware.openfire namespace prefix (rather than com.jivesoftware.openfire).</li>
</ul>
<p><b>1.3.4</b> -- January 10, 2015</p>
<p>Bug fixes:</p>
<ul>
......
......@@ -15,7 +15,7 @@
~ limitations under the License.
-->
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd"
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.4.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<group>
......@@ -59,7 +59,20 @@
Any integer between 0 and Integer.MAX_VALUE. 0 means
Integer.MAX_VALUE. Default is 0.
-->
<max-size-per-jvm>0</max-size-per-jvm>
<max-size>0</max-size>
<!--
Number of backups. If 1 is set as the backup-count for example,
then all entries of the map will be copied to another JVM for
fail-safety. 0 means no backup.
-->
<backup-count>1</backup-count>
<!--
Number of async backups. 0 means no backup.
-->
<async-backup-count>0</async-backup-count>
<empty-queue-ttl>-1</empty-queue-ttl>
<!--
Name of the map configuration that will be used for the backing distributed
map for this queue.
......@@ -70,6 +83,15 @@
Default Hazelcast cache configuration for Openfire.
-->
<map name="default">
<!--
Data type that will be used for storing recordMap.
Possible values:
BINARY (default): keys and values will be stored as binary data
OBJECT : values will be stored in their object forms
NATIVE : values will be stored in non-heap region of JVM
-->
<in-memory-format>BINARY</in-memory-format>
<!--
Number of backups. If 1 is set as the backup-count for example,
then all entries of the map will be copied to another JVM for
......
<?xml version="1.0" encoding="UTF-8"?>
<plugin>
<class>com.jivesoftware.openfire.HazelcastPlugin</class>
<class>org.jivesoftware.openfire.plugin.HazelcastPlugin</class>
<name>${plugin.name}</name>
<description>${plugin.description}</description>
<author>Tom Evans</author>
<version>1.3.4</version>
<date>01/10/2015</date>
<version>2.0.0</version>
<date>02/06/2015</date>
<minServerVersion>3.9.4</minServerVersion>
</plugin>
......@@ -65,7 +65,32 @@ open source <a href="http://www.hazelcast.org">Hazelcast</a> data distribution
framework in lieu of an expensive proprietary third-party product.
</p>
<p>
The current Hazelcast release is version 3.3.3.
The current Hazelcast release is version 3.4.
</p>
<h3>Clustering vs. Federation</h3>
<p>XMPP is designed to scale in ways that are similar to email. Each Openfire
installation supports a single XMPP domain, and a server-to-server (S2S)
protocol as described in the specification is provided to link multiple XMPP
domains together. This is known as federation. It represents a powerful way to
"scale out" XMPP, as it allows an XMPP user to communicate securely with any
user in any other such federated domain. These federations may be public or
private as appropriate. Federated domains may exchange XMPP stanzas
across the Internet (WAN) and may even discover one another using DNS-based
service lookup and address resolution.
</p>
<p>By contrast, clustering is a technique used to "scale up" a single XMPP domain.
The server members within a cluster all share an identical configuration. Each
member will allow any user within the domain to connect, authenticate, and exchange
stanzas. Clustered servers all share a single database, and are also required to
be resident within the same LAN-based (low latency) network infrastructure. This
type of deployment is suitable to provide runtime redundancy and will support a
larger number of users and connections (within a single domain) than a single
server would be able to provide.
</p>
<p>For very large Openfire deployments, a combination of federation and clustering will
provide the best results. Whereas a single clustered XMPP domain will be able to
support tens or even hundreds of thousands of users, a federated deployment will be
needed to reach true Internet scale of millions of concurrent XMPP connections.
</p>
<h2>Installation</h2>
<p>
......@@ -181,10 +206,10 @@ that will be added to the plugin's classpath. This allows a custom Hazelcast
configuration file to be located outside the Openfire home directory.</li>
<li><i>hazelcast.config.jmx.enabled</i> (false): Enables JMX support for
the Hazelcast cluster if JMX has been enabled via the Openfire admin console.
Refer to the <a href="http://docs.hazelcast.org/docs/3.3/manual/html/monitoringwithjmx.html">
Refer to the <a href="http://docs.hazelcast.org/docs/3.4/manual/html/monitoringwithjmx.html">
Hazelcast JMX docs</a> for additional information.</li>
</ol>
<p>The Hazelcast plugin uses the <a href="http://docs.hazelcast.org/docs/3.3/manual/html/config.html">
<p>The Hazelcast plugin uses the <a href="http://docs.hazelcast.org/docs/3.4/manual/html/configurationoverview.html">
XML configuration builder</a> to initialize the cluster from the XML file described above.
By default the cluster members will attempt to discover each other via multicast at the
following location:
......@@ -210,8 +235,33 @@ following alternative:
&lt;/join&gt;
...
</pre>
<p>Please refer to the <a href="http://docs.hazelcast.org/docs/3.3/manual/html-single/">
<p>Please refer to the <a href="http://docs.hazelcast.org/docs/3.4/manual/html-single/">
Hazelcast reference manual</a> for more information.
</p>
<h3>A Word About Garbage Collection</h3>
<p>Hazelcast is quite sensitive to delays that may be caused by long-running GC cycles which are typical
of servers using a default runtime JVM configuration. In most cases it will be preferable to activate the
concurrent garbage collector (CMS) or the new G1 garbage collector to minimize blocking within the JVM.
When using CMS, you may be able to counter the effects of heap fragmentation by using JMX to invoke
System.gc() when the cluster is relatively idle (e.g. overnight). This has the effect of temporarily
interrupting the concurrent GC algortithm in favor of the default GC to collect and compact the heap.
</p>
<p>In addition, the runtime characteristics of your Openfire cluster will vary greatly depending on the
number and type of clients that are connected, and which XMPP services you are using in your deployment.
However, note that because many of the objects allocated on the heap are of the short-lived variety,
increasing the proportion of young generation (eden) space may also have a positive impact on performance.
As an example, the following OPENFIRE_OPTS have been shown to be suitable in a three-node cluster of
servers (four CPUs each), supporting approximately 50k active users:
</p>
<pre>
OPENFIRE_OPTS="-Xmx4G -Xms4G -XX:NewRatio=1 -XX:SurvivorRatio=4
-XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:+UseParNewGC
-XX:+CMSParallelRemarkEnabled -XX:CMSFullGCsBeforeCompaction=1
-XX:CMSInitiatingOccupancyFraction=80 -XX:+UseCMSInitiatingOccupancyOnly
-XX:+PrintGCDetails -XX:+PrintPromotionFailure"
</pre>
<p>This GC configuration will also emit helpful GC diagnostic information to the console to aid further
tuning and troubleshooting as appropriate for your deployment.
</p>
</body>
</html>
......@@ -18,7 +18,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire;
package org.jivesoftware.openfire.plugin;
import java.io.File;
import java.io.FileFilter;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import java.io.IOException;
import java.io.ObjectInput;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.ComponentSession;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.Session;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.XMPPServer;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.IncomingServerSession;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.OutgoingServerSession;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.dom4j.Element;
import org.dom4j.tree.DefaultElement;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.ConnectionMultiplexerSession;
import org.jivesoftware.util.cache.ClusterTask;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.SessionManager;
import org.jivesoftware.openfire.session.IncomingServerSession;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.OutgoingServerSession;
import org.jivesoftware.util.cache.ClusterTask;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import java.net.UnknownHostException;
import java.util.Date;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.*;
import org.xmpp.packet.JID;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.openfire.session;
package org.jivesoftware.openfire.plugin.session;
import org.jivesoftware.openfire.session.Session;
import org.jivesoftware.util.Log;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.util.Set;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.io.File;
import java.io.IOException;
......
......@@ -18,7 +18,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
......
......@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.util.ArrayList;
import java.util.Collection;
......@@ -38,6 +38,7 @@ import org.jivesoftware.openfire.cluster.ClusterNodeInfo;
import org.jivesoftware.openfire.cluster.NodeID;
import org.jivesoftware.openfire.handler.DirectedPresence;
import org.jivesoftware.openfire.handler.PresenceUpdateHandler;
import org.jivesoftware.openfire.plugin.util.cluster.HazelcastClusterNodeInfo;
import org.jivesoftware.openfire.session.ClientSessionInfo;
import org.jivesoftware.openfire.session.IncomingServerSession;
import org.jivesoftware.openfire.session.RemoteSessionLocator;
......@@ -64,7 +65,6 @@ import com.hazelcast.core.Member;
import com.hazelcast.core.MemberAttributeEvent;
import com.hazelcast.core.MembershipEvent;
import com.hazelcast.core.MembershipListener;
import com.jivesoftware.util.cluster.HazelcastClusterNodeInfo;
/**
* ClusterListener reacts to membership changes in the cluster. It takes care of cleaning up the state
......@@ -473,9 +473,11 @@ public class ClusterListener implements MembershipListener, LifecycleListener {
Collection<JID> getHandlers(EntryEvent event) {
Object value = event.getValue();
Collection<JID> answer = new ArrayList<JID>();
if (value != null) {
for (DirectedPresence directedPresence : (Collection<DirectedPresence>)value) {
answer.add(directedPresence.getHandler());
}
}
return answer;
}
......
......@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.util.Collection;
import java.util.HashMap;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cache;
package org.jivesoftware.openfire.plugin.util.cache;
import java.io.Serializable;
import java.text.MessageFormat;
......@@ -41,6 +41,9 @@ import org.jivesoftware.openfire.JMXManager;
import org.jivesoftware.openfire.XMPPServer;
import org.jivesoftware.openfire.cluster.ClusterNodeInfo;
import org.jivesoftware.openfire.cluster.NodeID;
import org.jivesoftware.openfire.plugin.session.RemoteSessionLocator;
import org.jivesoftware.openfire.plugin.util.cluster.ClusterPacketRouter;
import org.jivesoftware.openfire.plugin.util.cluster.HazelcastClusterNodeInfo;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.cache.Cache;
......@@ -58,9 +61,6 @@ import com.hazelcast.core.Cluster;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.Member;
import com.jivesoftware.openfire.session.RemoteSessionLocator;
import com.jivesoftware.util.cluster.ClusterPacketRouter;
import com.jivesoftware.util.cluster.HazelcastClusterNodeInfo;
/**
* CacheFactory implementation to use when using Hazelcast in cluster mode.
......@@ -311,7 +311,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
/*
* Execute the given task on the designated cluster members.
* Note that this method blocks for up to MAX_CLUSTER_EXECUTION_TIME
* (seconds) until the task is run on all members.
* (seconds) per member until the task is run on all members.
*/
public Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) {
if (cluster == null) { return Collections.emptyList(); }
......@@ -329,7 +329,7 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
logger.debug("Executing MultiTask: " + task.getClass().getName());
Map<Member, Future<Object>> futures = hazelcast.getExecutorService(HAZELCAST_EXECUTOR_SERVICE_NAME)
.submitToMembers(new CallableTask<Object>(task), members);
long nanosLeft = TimeUnit.SECONDS.toNanos(MAX_CLUSTER_EXECUTION_TIME);
long nanosLeft = TimeUnit.SECONDS.toNanos(MAX_CLUSTER_EXECUTION_TIME*members.size());
for (Future<Object> future : futures.values()) {
long start = System.nanoTime();
result.add(future.get(nanosLeft, TimeUnit.NANOSECONDS));
......
......@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.jivesoftware.util.cluster;
package org.jivesoftware.openfire.plugin.util.cluster;
import java.io.IOException;
import java.io.ObjectInput;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cluster;
package org.jivesoftware.openfire.plugin.util.cluster;
import org.jivesoftware.openfire.RemotePacketRouter;
import org.jivesoftware.util.cache.CacheFactory;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cluster;
package org.jivesoftware.openfire.plugin.util.cluster;
import org.jivesoftware.openfire.cluster.ClusterManager;
import org.jivesoftware.openfire.cluster.ClusterNodeInfo;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cluster;
package org.jivesoftware.openfire.plugin.util.cluster;
import java.io.IOException;
import java.io.ObjectInput;
......
......@@ -17,7 +17,7 @@
* limitations under the License.
*/
package com.jivesoftware.util.cluster;
package org.jivesoftware.openfire.plugin.util.cluster;
import java.io.IOException;
import java.io.ObjectInput;
......
<%@ page import="com.jivesoftware.util.cluster.NodeRuntimeStats,
<%@ page import="org.jivesoftware.openfire.plugin.util.cluster.NodeRuntimeStats,
org.jivesoftware.util.cache.CacheFactory,
com.hazelcast.core.Hazelcast,
com.hazelcast.core.Cluster,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment