[GIS] GeoWebCache and Load Balancing

apachegeoservergeowebcachetomcatwms

We have a setup that contains 4 geoserver instances being hosted in JBoss across 2 machines. We also have a load balancer machine which contains an Apache Server and a Tomcat Server. Our environment contains a GeoWebCache instance that has all of the requested layers configured. Each layer has 4 WMS URL’s specified (1 for each geoserver instance serving the tile).

It has never been a problem in the past but over the last month our load has greatly increased. In doing some load testing we determined that the vast majority of the incoming requests to the GeoWebCache are going to the first configured WMS URL in the geowebcache.xml for each layer. Is there any way to configure GeoWebCache through the geowebcache.xml to balance the requests across all 4 of the WMS URL’s that we have configured? Also, please note that there is 1 layer that gets more traffic than all of the rest.

Best Answer

The geowebcache website provides a good guide on resource allocation and modifying the geowebcache.xml file.

Each GWC internally synchs to avoid two requests end up working on the same meta tile, but by default separate GWC instances do not and will end up wasting time. In case you want to make sure two separate instances do not end up working on the same metatile you have two options:

    make it unlikely for two instances to work on the same metatile by using sticky sessions in the load balancer (very often requests for the tiles making up a metatile originate from the same client)  
    switch to file based locking so that the GWC instances properly synch up activity