[MapServer-users] Speeding up msDrawMap() for shapefiles
Matthew Graber
grabermtw at gmail.com
Fri Dec 8 11:46:50 PST 2023
Hi,
I'm trying to speed up the time required for msDrawMap() to execute for
rendering shapefiles. Currently, according to the mapserver logs, it's
taking 2.5-3.5 seconds, sometimes up to 5 seconds for it to execute:
[Wed Dec 6 18:43:47 2023].699791 CGI Request 53 on process 2641
[Wed Dec 6 18:43:47 2023].717216 msDrawMap(): rendering using outputformat
named png (AGG/PNG).
[Wed Dec 6 18:43:52 2023].299580 msDrawMap(): Layer 1010
(Shapefile_Layer), 4.582s
[Wed Dec 6 18:43:52 2023].299792 msDrawMap(): Drawing Label Cache, 0.000s
[Wed Dec 6 18:43:52 2023].299803 msDrawMap() total time: 4.584s
[Wed Dec 6 18:43:52 2023].310853 msSaveImage(stdout) total time: 0.011s
[Wed Dec 6 18:43:52 2023].310883 mapserv request processing time
(msLoadMap not incl.): 4.611s
The mapfile is currently set up using "CONNECTIONTYPE OGR" and "CONNECTION"
to access the shapefiles from an S3 bucket as follows:
CONNECTIONTYPE OGR
CONNECTION '/vsis3/s3_bucket_path/my_shapefile%.shp'
I noticed at https://mapserver.org/input/vector/shapefiles.html that it
says "Shapefile access is built directly into MapServer. It is also
available through OGR, but direct access without OGR is recommended and
discussed here."
So I tried removing "CONNECTIONTYPE OGR" and changing "CONNECTION" to
"DATA" as follows:
DATA '/vsis3/s3_bucket_path/my_shapefile%.shp'
I haven't been able to observe any definitive speed improvements by doing
this yet, although I can't say for sure that there aren't any.
Based on https://mapserver.org/optimization/vector.html, I also tried using
the shptree command to create a spatial index and the coshp command to sort
the shapefile and index. Even after doing that, I still see load
msDrawMap() times of up to 5 seconds.
Does anyone know of any other optimizations that could be made here? Or if
not, would using shptree and coshp on the shapefile and then accessing it
in the mapfile using "DATA" to take it from S3 be the optimal way to set
things up?
Thanks!
Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20231208/2ddc7dcd/attachment.htm>
More information about the MapServer-users
mailing list