:orphan:

.. _section_example_fastrocs_multiserverloadbalancing:

Multi-Server Load Balancing
===========================

To spread a database across multiple servers the database must first
be appropriately chunked. A ShapeDatabaseServer.py is started on each
host with its corresponding database chunk. ShapeDatabaseProxy.py is
then used to tie all the servers together to appear like a single
shape database service to client applications. Theoretically, there is
no need for the client to know whether it is querying one or many
servers.

The general work-flow is as follows:

1. Split up database into 2 servers::


      ShapeDatabaseChunker.py database.oeb.gz database_shapedb.oeb.gz 2

2. Start a shape database server on each host::

      # host1
      ShapeDatabaseServer.py database_shapedb_1.oeb.gz

      # host2:
      ShapeDatabaseServer.py database_shapedb_2.oeb.gz

3. Start a proxy server to point to all the hosts. Note, a different
   port number like 8081 may need to be specified if the proxy server
   is being started on a host that already has a
   ShapeDatabaseServer.py started on it.::

      # proxy
      ShapeDatabaseProxy.py host1:8080 host2:8080 8081

4. Query the proxy server::


      ShapeDatabaseClient.py proxy:8081 query.sdf overlays.oeb
