I'm using mapserver to create a map that will be displayed with the google map api. I'm encountering performances issues.
My maps are all in shapefile format.
I run tests to get time to render maps.
When rendering a map with the shp2img tool, using command line
shp2img -i gif -m C:\myfolder\mymapfile.map -o C:\myfolder\test.gif -all_debug 5 -map_debug 5
I get the following metrics from the log files:
[Thu Apr 30 13:50:19 2009].148000 msLoadMap(): 0.000s
[Thu Apr 30 13:50:19 2009].180000 msDrawMap(): Layer 0 (PWorld2), 0.032s
[Thu Apr 30 13:50:19 2009].180000 msDrawMap(): Drawing Label Cache, 0.000s
[Thu Apr 30 13:50:19 2009].180000 msDrawMap() total time: 0.032s
[Thu Apr 30 13:50:19 2009].195000 msSaveImage() total time: 0.015s
[Thu Apr 30 13:50:19 2009].195000 msFreeMap(): freeing map at 01595E18.
[Thu Apr 30 13:50:19 2009].195000 freeLayer(): freeing layer at 0159CD00.
[Thu Apr 30 13:50:19 2009].195000 shp2img total time: 0.047s
When rendering the same map through mapserver, using
http://localhost/cgi-bin/mapserv.exe?mymapfile.map&layers=&mode=tile&tilemode=gmap&tile=1+1+2
log file is giving this:
[Thu Apr 30 13:51:50 2009].664000 CGI Request 1 on process 3520
[Thu Apr 30 13:51:50 2009].664000 msTileSetExtent (-10013744.792915, 8348.961808) (-5009.377085, 10010405.208192)
[Thu Apr 30 13:51:51 2009].23000 msDrawMap(): Layer 0 (PWorld2), 0.359s
[Thu Apr 30 13:51:51 2009].23000 msDrawMap(): Drawing Label Cache, 0.000s
[Thu Apr 30 13:51:51 2009].23000 msDrawMap() total time: 0.359s
[Thu Apr 30 13:51:51 2009].23000 msSaveImage() total time: 0.000s
[Thu Apr 30 13:51:51 2009].23000 mapserv request processing time (loadmap not incl.): 0.359s
[Thu Apr 30 13:51:51 2009].23000 msFreeMap(): freeing map at 01598690.
For the same map, the shp2img tool is rendering map 10 times faster than mapserver. When adding more layers and using the tiling mode for google map, can be up to 10 seconds.
Is somebody knows why mapserver is rendering this slow? Is there a workaround?