You might want to run depot servers behind an Apache load balancer. One benefit of load balancing is to increase the availability of your repository. This section shows two examples of load balancing.
If your repositories are load balanced, the catalogs in all of the repositories must be exactly the same to avoid problems when the load balancer switches clients from one node to another. To ensure that the catalogs are exactly the same, clone the repositories that participate in load balancing by using the pkgrecv --clone command as described in Maintaining Multiple Identical Local Repositories.
This example connects http://pkg.example.com/myrepo to internal1.example.com:10000 and internal2.example.com:10000.
Configure the depot server with an appropriate proxy_base setting as shown in Configuring a Simple Prefixed Proxy.
Limit the number of back-end connections to the number of threads each depot is running divided by the number of depots in the load-balancer setup. Otherwise, Apache opens more connections to a depot than are available and they stall, which can decrease performance. Specify the maximum number of parallel connections to each depot with the max= parameter. The following example shows two depots, each running 200 threads. See Configuring a Simple Prefixed Proxy for an example of how to set the number of depot threads.
<Proxy balancer://pkg-example-com-myrepo> # depot on internal1 BalancerMember http://internal1.example.com:10000 retry=5 max=100 # depot on internal2 BalancerMember http://internal2.example.com:10000 retry=5 max=100 </Proxy> Redirect /myrepo http://pkg.example.com/myrepo/ ProxyPass /myrepo/ balancer://pkg-example-com-myrepo/ nocanon
This example includes all of the directives you need to add to the httpd.conf file for a repository server that hosts a load-balanced and a non-load-balanced depot server setup.
In this example, two different prefixes of one domain name are connected to three different package repositories:
http://pkg.example.com/repo_one is connected to internal1.example.com:10000 and internal2.example.com:10000
http://pkg.example.com/repo_two is connected to internal1.example.com:20000
AddOutputFilterByType DEFLATE text/html application/javascript text/css text/plain AllowEncodedSlashes NoDecode MaxKeepAliveRequests 10000 ProxyTimeout 30 ProxyRequests Off <Proxy balancer://pkg-example-com-repo_one> # depot on internal1 BalancerMember http://internal1.example.com:10000 retry=5 max=100 # depot on internal2 BalancerMember http://internal2.example.com:10000 retry=5 max=100 </Proxy> Redirect /repo_one http://pkg.example.com/repo_one/ ProxyPass /repo_one/ balancer://pkg-example-com-repo_one/ nocanon Redirect /repo_two http://pkg.example.com/repo_two/ ProxyPass /repo_two/ http://internal.example.com:20000/ nocanon max=200