Parallelizing calls to msDrawLayer()

David Fuhry dfuhry at CS.KENT.EDU
Fri Oct 12 15:09:00 EDT 2007


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