Parallelizing calls to msDrawLayer()

Tamas Szekeres szekerest at GMAIL.COM
Sat Oct 13 17:15:52 EDT 2007


I consider it would be reasonable to establish such mechanism only
when fetching the data of the layers. Likewise currently the WMS/WFS
layers are pre-downloaded in parallel before starting to draw the map.
We should have a similar approach when fetching the other layers as

However pre drawing all of the layers and later copying the layers
over the map image seems to be much less efficient.

When using the parallel fetching approach we should deal only with the
drivers from the aspect of the thread safety issues.

Best regards,


2007/10/12, David Fuhry <dfuhry at>:
> Has anyone looked into parallelizing the calls to msDraw[Query]Layer()
> in msDrawMap()?
> Although I'm new to the codebase, it seems that near the top of
> msDrawMap(), we could launch a thread for each (non-WMS/WFS) layer,
> rendering the layer's output onto its own imageObj.  Then where we now
> call msDraw[Query]Layer, wait for thread i to complete, and compose that
> layer's imageObj onto the map's imageObj.
> In msDraw[Query]Layer(), critical sections of the mapObj (adding labels
> to the label cache, for instance) would need to be protected by a mutex.
> A threaded approach would let some layers get drawn while others are
> waiting on I/O or for query results, instead of the current serial
> approach where each layer is drawn in turn.  Multiprocessor machines
> could schedule the threads across all of their cores for simultaneous
> layer rendering.
> It seems this could significantly speed up common-case rendering,
> especially on big machines, for very little overhead.  Has there been
> previous work in this area, or are any major drawbacks evident?
> Thanks,
> Dave Fuhry

More information about the mapserver-dev mailing list