Load Balancing & Load Testing Strategies for Web Map Servers

Ian Turton, Astun Technology Ltd.

[email protected]

[email protected]



Why do you need a cluster?

Did you sort out your data?

GeoServer is fundamentally limited by how fast it can move data from disk to the map image.

So if the data is:

  1. on a slow (networked) disk,
  2. in a slow format (ASCII) or
  3. in a slow database (???)
  4. on a slow operating system (windows?)

then no amount of magic will speed things up much.

Did you configure your container?

There are a number of configuration changes you can make to speed up how GeoServer works.

At minimum check out the documentation on running in production

  1. Set relevant JVM flags
  2. Switch to the Marlin rasterizer (speeds up drawing maps)
  3. Install native JAI and ImageIO extensions
  4. Turn logging down to Production.

So you need more speed?

Make sure you are using a cache (GeoWebCache, MapProxy, etc.)

This way you only need to draw each piece of map once.

If possible pre-seed your cache down to a reasonable level.

How fast is fast enough?

For this you need to benchmark your existing server using JMeter (or other test suite).

If you are truly paranoid do this at every step with the JVM settings, data reformats etc.

At least before you start clustering for speed.


Things we'll need:

  1. A representative set of user requests
    • mine existing access log files
    • do some browsing to generate a representative session.
  2. Extract the relevant parameters
  3. Build a JMeter test plan

Access Logs (a brief introduction)

When ever some one asks for a map from your server a note is made of this in the access log file.

For tomcat this is in /var/log/tomcat8/localhost_access_log.<date>.txt - - [07/Mar/2018:09:06:37 +0000] "GET /geoserver/ HTTP/1.1" 302 - - - [07/Mar/2018:09:06:37 +0000] "GET /geoserver/web/ HTTP/1.1" 302 - - - [07/Mar/2018:09:06:37 +0000] "GET /geoserver/web/?0 HTTP/1.1" 200 4738 - - [07/Mar/2018:09:20:24 +0000] "GET /geoserver/web/?0 HTTP/1.1" 200 4715 - - [07/Mar/2018:09:20:24 +0000] "GET /geoserver/web/wicket/resource/org.geoserv... - - [07/Mar/2018:09:20:24 +0000] "GET /geoserver/web/wicket/resource/org.geoserv... - - [07/Mar/2018:09:20:24 +0000] "GET /geoserver/web/wicket/resource/org.geoserv... - - [07/Mar/2018:09:25:01 +0000] "GET /geoserver/wms?layers=ras250&styles=&SERVICE...

Extract the interesting bits

Could use awk or grep & sed, but this is hard work if you need to do it often, so automate.

LogfileUtils is a Java program to extract the interesting bits from a standard or Microsoft access log.

java logfileUtils -f /var/log/tomcat8/localhost_access_log.2018-03-06.txt \
-t wms|wmts -c request bbox layers width height layer \
tilematrixset tilematrix tilecol tilerow \
-o /home/ian/code/astun/logfileUtils/log.csv

Testing with JMeter

  1. load the provided jmx file.
  2. load the csv file
  3. adjust number of threads (users)
  4. run to check for errors
  5. run without GUI for accurate checks
jmeter -n -t [jmx file] -l [results file] -e -o [Path to web report folder]


Set Http Settings

Set CSV File

GetMap Request

GetTile Request


Clustering GeoServer

Active Clustering



and download



Provides a distributed GeoServer control system.

See the GeoSolutions training course for a good introduction and the manual for more details.

Clusters Machine(s)

Apache2 Httpd Conf

Add to conf file.

<Proxy balancer://cluster>
  BalancerMember ajp://localhost:8009 route=route1
  BalancerMember ajp://localhost:8010 route=route2
  ProxySet lbmethod=bybusyness

<Location /geoserver>
  Order allow,deny
  Allow from all
  ProxyPass balancer://cluster/geoserver stickysession=JSESSIONID

Run JMeter again


Right, Down, Page DownNext slide
Left, Up, Page UpPrevious slide
POpen presenter console
HToggle this help