I am making WMS calls (L.tileLayer.wms) to GeoServer and rendering the layers on a Leaflet map for a production environment, so I have maybe about 100+ concurrent users that might be constantly rendering layers

The issue that I am running into is that the WMS call to GeoServer can be super slow that the layers do not render at all. I can see in the Network calls that the WMS call is still pending. I was wondering how I can optimize GeoServer (or Tomcat) to speed up the layer rendering?

For background, I am using GeoServer version 2.17.2, hosting it on a AWS EC2 instance, and using Tomcat to run GeoServer. As for the CPU and Memory for the EC2 instance, the CPU is at 8 and 16GB for memory. For the store, I am using a PostGIS Database that is AWS RDS and all of my data is spatially indexed. Here is some info about the connection parameters:

Max Connection: 150
Min Connection: 1
Fetch size: 1000
Batch insert size: 100
Connection timeout: 20
Max Connection: 150
Max Connection: 150

I have already done GeoWebCaching for all of my layers on GeoServer already and all of my layers are vector data. I am not using raster data at all for this.

I am not sure what else I can do to optimize GeoServer to render my layers faster.. Should I upgrade the EC2 instance to have a higher CPU and memory to ensure faster speed? Or maybe do improvements on Tomcat? Some of my layers consist of 10,000+ rows so they can be fairly large datasets.

Another thing I would like to add is that I cannot access the Geoserver UI at all when the rendering of the layers are super slow. It takes forever for it to load the Geoserver webpage / it doesn't load whatsoever unless I restart the tomcat

  • Can you clarify when you say and all of my layers are vector data. are you meaning the input data, or the output data.
    – nmtoken
    Commented Dec 16, 2020 at 18:56
  • 1
    Have you tried pre-seeding the layers?
    – Ian Turton
    Commented Dec 17, 2020 at 8:41
  • @nmtoken the output data, what I am showing on the map, is vector data Commented Dec 17, 2020 at 19:29
  • @Ian Turton I haven't tried that, how does pre-seeding layers look like? Commented Dec 17, 2020 at 19:30
  • @IanTurton scaling using cluster plugin is perfect.
    – ArashMad
    Commented Dec 17, 2020 at 22:16

2 Answers 2


I have had this problem before, ill see if i can explain what I remember. The problem existed with Apache. We had load balancing implemented which enabeld concurrent apache tomcat sessions. This improved performance. Sometimes we would notice that one of the ports would just stop responding or returning a result.

There was a cache associated with each apache session. We needed to clear each day.

So - load balanced or not, check out your cache settings on apache. https://tomcat.apache.org/tomcat-9.0-doc/config/resources.html

Another way you can eliminate what is the problem in the stack, is when users are having the issue, logon to the Geoserver server itself, and try previewing layers. If the layers are responding in the layer preview in a suitable manner, then you can eliminate that part of the stack as being the problem and look 'upwards'. If they are still slow, then you can eliminate the 'upward' part, and look down (geoserver or database).

  • Huh interesting... Where do I go to check my cache settings on Tomcat? Commented Dec 17, 2020 at 19:33
  • Also when users are making calls to GeoServer and the layers take forever to render on the map, I can't log onto the Geoserver UI whatsoever. It's super slow and doesn't load -- which I am assuming why it takes forever to make a WMS call to Geoserver and load up the layer as well Commented Dec 17, 2020 at 20:43
  • you may have a memory leak then if the Geoserver UI is slow to respond, check your geoserver logs here..... with regards to tomcat cache clearing, try this link......stackoverflow.com/questions/27212035/…
    – nr_aus
    Commented Dec 20, 2020 at 9:44

Geoserver supports horizontally and vertically scalled architectures, This is achieved by applying cluster extension on geoserver.

A vertical architecture provides you with some nodes that work alongside a master node and helps you to respond too many requests simultaneously.

You need also a load balancer to manage received requests. I used it for my application and I could see a big change so that the performance was improved and the response time decreased significantly.

Remember JAVA_OPTION in order to increase java heap size should be considered.

Here you can find detailed information about both architectures and you can compare them.

  • agree with the load balancer comment also.
    – nr_aus
    Commented Dec 20, 2020 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.