Cloudogu Logo

Hello, we are Cloudogu!

Experts in Software Lifecycle Management and process auto­mation, supporter of open source soft­ware and developer of the Cloudogu EcoSystem.

featured image SVN Repository Server Load Balancing and Synchronization
04/01/2014 in Software Craftsmanship

SVN Repository Server Load Balancing and Synchronization

Daniel Huchthausen
Daniel Huchthausen

IT Consultant

Table of Contents
+++This post was migrated from our former blog about SCM-Manager Universe. Therefore, the design is slightly different and some information might not be 100% applicable to Cloudogu EcoSystem. So don't be alarmed; enjoy reading.+++

In our support work of the recent past we saw that the topic of SVN repository synchronization seems to be a current issue. Therefore we want to show you how you can implement a master/slave server structure for load balancing. Slave servers are used for read operations and the master for write operations.


The reason why it is necessary to divide read and write operations to different servers is the behavior of users. Normally it is more likely that users are performing read operations such as checkouts, updates, etc. than write operations such as commits or revision property changes. Therefore the server performance can be increased by dividing those two tasks onto two different kinds of servers, lets call them master and slave. Multiple slave servers are used for read operations and the master server is used for all write operations. To ensure that the users are reading the latest versions from the slave servers it is necessary to synchronize the slave servers with the master. A setup of master and slave servers could look like this:

Synchronization of Master and Slave

Since version 1.5 SVN supports the feature “Write-through proxy”. It enables the setup of one master/slave server system, where the master is associated with a repository for read and write operations, and several slave servers that are handling only read operations. The slave servers are passing through (proxying) write operations to the master server. A system like this requires “Apache HTTP Server” on the master and slave servers with at least version 2.2.x and the slave servers need “mod_proxy” enabled.


The implementation requires the modification of the httpd.conf files of the master and slave servers. You need to perform the following few steps to implement the system:

  1. Configure the master server to expose the repository by adding a new block to the httpd.conf file: <lt;Location /svn/project>    DAV svn    SVNPath /opt/svn/project (path to the repository on the slave server) </Location>

  2. Configure the slave server by adding a new block to the httpd.conf file: <Location /svn/project>    DAV svn    SVNPath /opt/svn/project (path to the repository on the slave server)    SVNMasterURI http://*IP-ADDR-OF-MASTER*/svn/project/ </Location>

  3. Configure slave server to enable svnsync by adding another block to the slaves httpd.conf file: <Location /svn/project-proxy-sync>    DAV svn    SVNPath /opt/svn/project (path to the repository on the slave server)    Order deny,allow    Deny from all    Allow from *IP-ADDR-OF-MASTER* <Location /svn/project>

  4. Enable the constant synchronization of the slave repository by using the master repositories hook for svnsync:

    1. #!/bin/sh REVISION=${2} # Launch (backgrounded) sync jobs for each slave server. svnsync copy-revprops http://*IP-ADDR-OF-SLAVE*/svn/project-proxy-sync ${REVISION} &

    2. #!/bin/sh # Launch (backgrounded) sync jobs for each slave server svnsync sync http://*IP-ADDR-OF-SLAVE1*/svn/project-proxy-sync &

Now the basic configuration is finished. Depending on your needs and system you can extend the configuration with authentication and authorization, handling of lock/unlock requests and the handling of connection problems during the synchronization or a write operation. In any case it is necessary to realize at least read access at the slave servers and read/write access at the master server for all users. The authentication needs to match across all servers and also needs to be synced. The implementation of the authentication and authorization needs to be performed corresponding to your authentication system.

With kind regards, your SCM-Manager Support Team