Relatively slow when rendering large sets of points in GeServer

57 views
Skip to first unread message

Manuel Timita

unread,
Apr 15, 2021, 9:00:42 AM4/15/21
to marlin-renderer
Hi Laurent,

Marlin is really great at rendering lines and polygons. However, I noticed considerably slower tiles in GeoServer when we render a similar amount of points (e.g. rendering 100K polygon features is faster than 100K points, despite the former having obviously more vertices). 

This slowdown is not obvious when the points are styled using an external PNG image. This makes me think that, when the point is styled without using an external image, GeoServer may be repeatedly rasterizing the point symbolizer unnecessarily, with every paint.

I'm trying to understand whether this is something which can be addressed in Marlin, or requires improvements on the GeoServer side.

Many thanks!
Manuel

Laurent Bourgès

unread,
Apr 15, 2021, 3:36:51 PM4/15/21
to marlin-...@googlegroups.com
Dear Manuel,

Le jeu. 15 avr. 2021 à 15:00, Manuel Timita <tim...@gmail.com> a écrit :
Hi Laurent,

Marlin is really great at rendering lines and polygons. However, I noticed considerably slower tiles in GeoServer when we render a similar amount of points (e.g. rendering 100K polygon features is faster than 100K points, despite the former having obviously more vertices). 

Even if the number of points looks the same, you have 2 cases:
- render 1 shape with 100k points
- render 100k shapes but simple (4 edges)

For every draw/fill operation, Marlin rasterizes the shape in tiles (masks) and the java2d pipeline performs surface blending (C loops for geoserver), using Paint & Composite.
That's nice as every shape can have its own color and transparency :  overlapping points are fading / mixing...

As you pointed, Marlin is fast with 100k polygons, I think the pixel blending stage is the bottleneck.

Using jvisualvm, it is quite easy to see if how much time is taken by MaskFill methods().


This slowdown is not obvious when the points are styled using an external PNG image. This makes me think that, when the point is styled without using an external image, GeoServer may be repeatedly rasterizing the point symbolizer unnecessarily, with every paint.

Yes, I think it is the case.
This is slower as every shape must be painted... so it represents 100k blending operations !

If you do not use transparency nor different colors, it would be possible to paint 1 shape made of many rectangles (closed shape), to have less blending passes.
That's the painter problem: colors are mixed using alpha compositors, transparency...


I'm trying to understand whether this is something which can be addressed in Marlin, or requires improvements on the GeoServer side.

Probably it would be best to cache symbols into images and use drawImage in geoserver, but it may be less precise (re-gridding problem of AA mask).

Finally for such dense plots, there are certainly other approaches to make heatmaps or density plots...

Cheers,
Laurent

Manuel Timita

unread,
Apr 16, 2021, 7:10:46 AM4/16/21
to marlin-renderer
Dear Laurent,

Thank you for the very detailed and insightful reply. This certainly answers my question, and more :-)
I am a little familiar with Geotools. Looking at some of the style factories in its renderer, the situation got a little bit clearer. Caching the symbol as an image may be the way to go, just as you suggested.

Creating density maps is the more usual approach, indeed. Though here I have a case of a dataset with millions of points, which needs to be visible to users at certain zoom levels to allow for slicing and dicing the data. In this case, an image symbol does the job. The points are rendering fast enough for the task.

Best regards,
Manuel

On Thursday, April 15, 2021 at 8:36:51 PM UTC+1 bourges.laurent wrote:
Dear Manuel,
Reply all
Reply to author
Forward
0 new messages