[ka-Map-users] KaMap performance tuning

Stephen Woodbridge woodbri at swoodbridge.com
Tue May 22 10:08:21 EDT 2007


Jeff,

You need to make sure you are comparing apples to apples. For example:

What is the size of the image you are generating with shp2img and 
mapserver CGI? What is the size of the image you are generating with 
tile.php? You also need to account for the fact that tile.php creates a 
metatile and then chops it into 5x5 or 6x6 tiles depending on your 
configuration. It also has to file all the tiles it creates into the 
tile-cache which is a lot of file I/O. You could add some timing stats 
to tile.php to figure out how much time is spent doing what and print 
the results to stderr and view that in the apache error log.

While tile.php is really straight forward, it is doing a lot of extra 
work that is not getting done in shp2img or mapserver CGI.

-Steve W


Paul Spencer wrote:
> Hi Jeff,
> 
> this is an interesting analysis.  For the record, I always thought 
> properly tuned shapefiles (tiled, indexed, sorted) were faster than any 
> other format.
> 
> I suspect that the actual map rendering time relative to the other 
> processes involved (as you said, Apache, PHP and also the PHP code that 
> slices the resulting image, plus using wget invokes a network stack and 
> various other communications pieces) is fairly insignificant in your 
> case (and perhaps in general).  I don't really know of a good way to 
> isolate the various factors.  Well, you could look into using xdebug 
> with PHP and invoking tile.php directly to see what the overhead is.
> 
> If this is the case, it would be awesome to have a custom libmap 
> executable that could take the place of tile.php - essentially a C 
> program (preferably that could run either on command line or as cgi) 
> that would create tiles built on top of the mapserver C API (such as it 
> is).  Given the simplicity of the task, any scripted approach (such as 
> tile.php) is going to be less than optimal.
> 
> Any volunteers?
> 
> Paul
> 
> 
> On 21-May-07, at 3:25 PM, Jeff Dege wrote:
> 
>> We've been using KaMap with Mapserver and OpenLayers, with some success.
>> We've recently begin looking at using PostGIS instead of shapefiles,
>> hoping to getter performance when generating maps that haven't yet been
>> tiled.
>>
>> So we loaded our shapefiles into PostGIS tables, and created a new map
>> file that was a copy of the first, except that it got its map data from
>> the PostGIS tables.
>>
>> Our first comparison was using shp2img, which showed a dramatic decrease
>> in the time needed to generate maps - with our data, PostGIS was eight
>> to ten times faster.
>>
>> So we cleared out our tile cache, pointed KaMap at the PostGIS map file,
>> and saw very little difference.
>>
>> So we created a batch file that would download a thousand different
>> tiles, using wget to make direct calls against tile.php, and timed how
>> long it took to run, with the shapefile and the PostGIS map files.  The
>> PostGIS test was only five percent that the shapefile test.
>>
>> So we created yet another batch file that used wget to make direct calls
>> against mapserver.exe, running in CGI mode.  When generating maps from
>> PostGIS data, mapserver was eight times faster than against shapefiles.
>>
>> So now the question:  If the image creation is so much faster, when
>> accessed through shp2img, and when accessed through mapserver.exe, why
>> is that speed improvement not visible when loading tiles through kamap's
>> tile.php?
>>
>> It's clear to me that there must be some bottleneck, reducing
>> performance.  My guess would be in Apache or PHP configuration.
>>
>> Does anyone know how I can measure what time is being spent doing what,
>> in this area?  What configuration options I should look at, to try to
>> improve performance?
>>
>> Thanks.
>>
>>
>> _______________________________________________
>> ka-Map-users mailing list
>> ka-Map-users at lists.maptools.org
>> http://lists.maptools.org/mailman/listinfo/ka-map-users
> 
> +-----------------------------------------------------------------+
> |Paul Spencer                          pspencer at dmsolutions.ca    |
> +-----------------------------------------------------------------+
> |Chief Technology Officer                                         |
> |DM Solutions Group Inc                http://www.dmsolutions.ca/ |
> +-----------------------------------------------------------------+
> 
> 
> 
> 
> 
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users



More information about the ka-Map-users mailing list