For most of our large clients where SymmetricDS is playing a mission critical role in their organization, our customers take advantage of SymmetricDS Pro's out of the box capabilities to be load balanced. While SymmetricDS does a great job with hands off recovery in cases of hardware or infrastructure failure, most clients want as little downtime as possible. They simply don't want a single point of failure in their synchronization scenario. The good news is, with SymmetricDS Pro, load balancing is simple and straight forward.

The Scenario

In many of these scenarios, SymmetricDS Pro is synchronizing a large server database with thousands of client databases. Most people are ok with the client databases being at risk of downtime due to client infrastructure, but the server is a different story. We see most people load balance the server by running two or more instances of SymmetricDS Pro on separate hardware, pointed to the same server database. Traffic is directed to one of the load balanced servers via some type of load balancer (mostly hardware based appliances).

Configuration Background

In order to understand the setup, it's helpful to understand the configuration that determines how SymmetricDS Pro nodes communicate with each other. In a typical synchronization scenario, one or more of the SymmetricDS Pro nodes are designated as the registration or root servers. These servers listen on a given port and URL for clients to request registration to the synchronization scenario. The port and URL they listen on are configured by setting the sync.url property on the server. This property is initially set during SymmetricDS Pro server setup, and can also be found by clicking "Configure", "Parameters" from the Pro Management Console, or by looking at the SymmetricDS properties file that gets written in the "engines" subdirectory of your installation.

In our scenario from above, the three Symmetric Pro Servers on the right are the registration servers.

On the client side, the clients need to know the URL to connect to in order to attempt registration to the synchronization scenario. This is the URL from above on which the registration servers are listening. On the client side, this is called the registration url and is setup during the client install, and can also be found by clicking "Configure", "Parameters" from the Pro Management Console, or by looking at the SymmetricDS properties file for the client.

Once the client attempts registration, the server sends the client it's sync.url property, so the client knows where to reach out to the server for subsequent synchronization requests and work. The registration URL is only used during the registration process, not for go forward synchronization. So, the client uses the registration url to know where to go to register, and then after that uses the sync.url sent from the server during the registration process for all go forward synchronization work.

Load Balancing Configuration

Knowing that background, setting up the load balanced setup from above is pretty simple. Here are the steps:

  • During Server setup, when specifying Communication Settings, instead of using the default sync URL, click the radio button that says "Define URL setting for load balancer or proxy." Then, type in the Hostname and Port for the load balancer itself. Behind the scenes, this sets the sync.url for the server to the hostname and port (URL) for the load balancer.
  • Set your load balancer to forward requests to any number of SymmetricDS Pro root servers, forwarding them to the server name and port on which SymmetricDS Pro is running on the individual servers.
  • During the client setup, when specifying the Registration URL, specify the URL from above that points to the load balancer. This will get written to the .properties file as the registration.url for the client.

The Result

The result of the configuration is as follows:

  • On the Servers, the Hostname and Port that you configured for the load balancer gets written to the server.properties file as the sync.url.
  • On the Clients, the Registration.URL that you specified gets written to the client .properties file.
  • When the Clients register, they point to the load balancer, which passes off the request to one of the three SymmetricDS Pro servers.
  • The server in turn sends its sync.url (which also points to the load balancer) back down to the client to tell it where to make future synchronization requests.
  • On subsequent synchronization requests from the client to the server, it looks at the sync.url that was given to it by the server (stored in sym_node table on the client). This url points to the load balancer which forwards the request to one of the actual Symmetric Servers.

Next Up

In the next couple of weeks, we'll add another couple of articles that discuss the following:

  • Now that I have SymmetricDS Pro load balanced, how do the servers distribute the work?
  • How do the SymmetricDS Pro servers stay out of each other's way, and know who's doing what?
  • We'll also show you how to use the open source apache http server as a load balancer.

Stay tuned for more!

Greg Wilmer
Author: Greg Wilmer

Greg has over 25 years experience in Information Technology spanning roles from developer to architect to VP and CIO.  He has designed and implemented products and systems for small shops, to Fortune 500 companies across many vertical markets including Retail, Health Care, Oil and Gas, Aerospace and many more.  His software experience spans signal processor work for AWACS planes to large scale integration projects for global enterprises.  He holds a Bachelors Degree in Computer Science from the Ohio State University and a Masters Degree in Engineering from MIT focusing on product design and development.