Running XWiki Cluster on Jelastic

By July 31, 2013 HowTo 4 Comments
Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

As you know it’s very easy to deploy XWiki to the Jelastic Cloud, with no code changes or any specific configurations. But what about XWiki cluster? Let’s see how it’s done!

XWiki cluster provides two XWiki instances in different servers (Tomcat 7 in our case) connected to the same database server (MySQL). All users’ requests are handled and distributed by an NGINX load balancer to different server nodes, according to their availability and server load. But XWiki has one very interesting trait: it uses tons of different caches to improve performance. For example, if you’ve modified a document on one XWiki instance, the other one can show older versions of this document from its cache. To eliminate this, XWiki uses an event distribution system, which generates a local event and then updates the caches within it. In such a way, all caches are updated after something has been changed on each instance of an XWiki cluster.

Follow the steps of the next tutorial and you’ll see how XWiki cluster works in the cloud.

Create environment

1. Log in to Jelastic and click on the Create environment button.

2. Create a highly available environment with Tomcat 7 and MySQL by picking the appropriate icons in the environment topology dialog.

XWiki Cluster Environment

Wait a few minutes and your environment will be created.

Deploy XWiki to the environment you’ve just created like it’s shown in our previous tutorial “How to deploy XWiki to Jelastic cloud: step-by-step tutorial”.

Configure XWiki cluster

XWiki provides a very simple way to setup clusters based on network events distribution.

1. Click the Config button for Tomcat.

XWiki Cluster Config

2. Navigate to xwiki.properties file (webapps/ROOT/WEB-INF) of any of the Tomcat nodes and set the property observation.remote.enabled to true in order to enable event distribution.

XWiki Cluster Event Distribution

Note: After you save the changes they will be applied for both Tomcat nodes, so you don’t have to duplicate all the settings for each server node.

3. Navigate to the jgroups directory (webapps/ROOT/WEB-INF/observation/remote) and add tcp.xml, where JGroup configuration is specified. It’s needed for communication channels setup.

XWiki Cluster JGroups

Here’s an example:

<config xmlns="urn:org:jgroups"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.2.xsd">
    <TCP bind_port="7800"
         loopback="false"
         recv_buf_size="${tcp.recv_buf_size:20M}"
         send_buf_size="${tcp.send_buf_size:640K}"
         max_bundle_size="64K"
         max_bundle_timeout="30"
         enable_bundling="true"
         use_send_queues="true"
         sock_conn_timeout="300"

         timer_type="wheel"
         timer.min_threads="4"
         timer.max_threads="10"
         timer.keep_alive_time="3000"
         timer.queue_max_size="500"

         thread_pool.enabled="true"
         thread_pool.min_threads="1"
         thread_pool.max_threads="10"
         thread_pool.keep_alive_time="5000"
         thread_pool.queue_enabled="false"
         thread_pool.queue_max_size="100"
         thread_pool.rejection_policy="discard"

         oob_thread_pool.enabled="true"
         oob_thread_pool.min_threads="1"
         oob_thread_pool.max_threads="8"
         oob_thread_pool.keep_alive_time="5000"
         oob_thread_pool.queue_enabled="false"
         oob_thread_pool.queue_max_size="100"
         oob_thread_pool.rejection_policy="discard"/>

    <TCPPING timeout="3000"
             initial_hosts="${jgroups.tcpping.initial_hosts:localhost[7800],localhost[7801]}"
             port_range="1"
             num_initial_members="10"/>
    <MERGE2 min_interval="10000"
            max_interval="30000"/>
    <FD_SOCK/>
    <FD timeout="3000" max_tries="3"/>
    <VERIFY_SUSPECT timeout="1500"/>
    <BARRIER/>
    <pbcast.NAKACK2 use_mcast_xmit="false"
                    discard_delivered_msgs="true"/>
    <UNICAST/>
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
                   max_bytes="4M"/>
    <pbcast.GMS print_local_addr="true" join_timeout="3000"

                view_bundling="true"/>
    <MFC max_credits="2M"
         min_threshold="0.4"/>
    <FRAG2 frag_size="60K"/>
    <!--RSVP resend_interval="2000" timeout="10000"/-->
    <pbcast.STATE_TRANSFER/>
</config>

4. Restart your Tomcat cluster.

XWiki Cluster Restart

5. Open your application in a browser, install XWiki and enjoy, with a highly reliable and scalable environment in the Cloud.

XWiki Cluster

6. You can easily view summary statistics on the resource consumption (Memory, CPU, Network and Hdd) for all your XWiki cluster nodes. Just click on the Statistics button for the necessary instance.

XWiki Cluster Statistics

XWiki-Cluster-Resources

Just imagine, in only in a few minutes you get a highly available clustered environment with perfect fail-over capabilities. Want to try this out? Start your free trial today!

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone

4 Comments

Leave a Reply

Subscribe to get the latest updates