how to speed up MapServer performance?

Zhonghai Wang zhonghaiw at GMAIL.COM
Tue May 16 01:09:07 PDT 2006


Hi my friends,

I am really very thankful for all your information, I am a newbie in
MapServer.

here is the data amount that I am using for the application:
(all the source data is MapInfo format, and what I calculated is the ".MAP"
file)

1. boundaries -- 388 KB
2. forests -- 9163 KB
3. lakes -- 26 KB
4. city parks -- 25 KB
5. settlement -- 2279 KB
6. rivers -- 1653 KB
7. road networks -- 56370 KB
8. railway -- 1343 KB
9. train station -- 27 KB
10 bus station -- 2 KB
11. tourist centers -- 9 KB
12. theaters -- 6 KB
13. shopping center -- 7 KB
14. city location -- 9 KB

*****
and here is how I am symbolizing the layers, mapfile for all these layers:

***
LAYER
    NAME "Country"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_COUNTRY.TAB"
    TRANSPARENCY 40
    DEBUG ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      #NAME "Boundaries"
      STYLE
        SYMBOL 0
        COLOR 155 155 155
        OUTLINECOLOR 155 155 155
        BACKGROUNDCOLOR 255 255 255
      END
    END
  END
  LAYER
    NAME "lakes"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_LAKE.TAB"
    DEBUG ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Lake"
      STYLE
        COLOR 102 153 255
      END
    END
  END
  LAYER
    NAME "woodland"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_WOODLAND_G.TAB"
    DEBUG ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "woodland"
      STYLE
        COLOR 0 185 92
      END
    END
  END
  LAYER
    NAME "woodland"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_WOODLAND.TAB"
    MAXSCALE 100000
    #LABELITEM "Street_Label"
    #SYMBOLSCALE 50000
    #LABELMAXSCALE 80000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "woodland"
      STYLE
        COLOR 0 185 92
      END
    END
  END
  LAYER
    NAME "city parks"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_CITY_PARK.TAB"
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Park"
      STYLE
        SYMBOL 0
        COLOR 233 254 205
      END
    END
  END
  LAYER
    NAME "settlement"
    STATUS DEFAULT
    TYPE POLYGON
    #CLASSITEM "Area"
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_BUILT_UP_AREA.TAB"
    MAXSCALE 800000
    #LABELITEM "Street_Label"
    #SYMBOLSCALE 80000
    #LABELMAXSCALE 120000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "settlement"
      #EXPRESSION ([Area]>20000)
      STYLE
        COLOR 207 207 158
      END
    END
  END
  LAYER
    NAME "rivers"
    STATUS DEFAULT
    TYPE POLYGON
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_WATERWYS.TAB"
    MAXSCALE 800000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "river"
      STYLE
        COLOR 102 153 255
      END
    END
  END
  LAYER
    NAME "street50"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_S50.TAB"
    MAXSCALE 40000
    LABELITEM "Street_Label"
    SYMBOLSCALE 5000
    LABELMAXSCALE 20000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Street 50"
      LABEL
        # must be in your FONTSET
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 2
        MAXSIZE 8
        ANGLE AUTO
       POSITION CC
       OFFSET 0 0
        COLOR 0 0 255
        MINFEATURESIZE AUTO
        BUFFER 0
      END
      STYLE
        SYMBOL "point"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        COLOR 255 255 255
      END
    END
  END
  LAYER
    NAME "oneway"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_ONEWAY.TAB"
    MAXSCALE 40000
    SYMBOLSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Oneway"
      STYLE
        SYMBOL "oneway"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        COLOR 255 51 0
      END
    END
  END
  LAYER
    NAME "street40"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_S40.TAB"
    MAXSCALE 100000
    LABELITEM "Street_Label"
    SYMBOLSCALE 15000
    LABELMAXSCALE 30000
    LABELCACHE ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Street 40"
      LABEL
        # must be in the FONTSET
        TYPE TRUETYPE
        FONT "vera"
        SIZE 9
        MINSIZE 2
        MAXSIZE 9
        ANGLE AUTO
       POSITION CC
       OFFSET 0 0
        COLOR 0 0 255
        MINFEATURESIZE 20
        BUFFER 0
      END
      STYLE
        SYMBOL "point"
        SIZE 10
        MINSIZE 3
        MAXSIZE 10
        COLOR 160 160 160
        ANTIALIAS TRUE
      END
      STYLE
        SYMBOL "point"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        COLOR 255 255 255
        ANTIALIAS TRUE
      END
    END
  END
  LAYER
    NAME "street30"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_S30.TAB"
    MAXSCALE 250000
    LABELITEM "Street_Label"
    SYMBOLSCALE 40000
    LABELMAXSCALE 120000
    LABELCACHE ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Street 30"
      LABEL
        # must be in your FONTSET
        TYPE TRUETYPE
        FONT "vera"
        SIZE 9
        MINSIZE 2
        MAXSIZE 9
        ANGLE AUTO
       POSITION CC
       OFFSET 0 0
        COLOR 0 0 255
        MINFEATURESIZE 30
        #MINDISTANCE 10
        BUFFER 0
      END
      STYLE
        SYMBOL "point"
        SIZE 10
        MINSIZE 3
        MAXSIZE 10
        COLOR 160 160 160
      END
      STYLE
        SYMBOL "point"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        COLOR 255 204 51
      END
    END
  END
  LAYER
    NAME "railway"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_RAILRDS.TAB"
    MAXSCALE 8000
    SYMBOLSCALE 4000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "railway"
        SYMBOL 'point'
        COLOR 0 0 0
        SIZE 5
        MINSIZE 1
        MAXSIZE 5
        OVERLAYSYMBOL "dashedline"
        OVERLAYCOLOR 255 255 255
        OVERLAYSIZE 3
        OVERLAYMINSIZE 0
        OVERLAYMAXSIZE 3
    END
  END
  LAYER
    NAME "street20"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_S20.TAB"
    MAXSCALE 900000
    LABELITEM "Street_Label"
    SYMBOLSCALE 100000
    LABELMAXSCALE 430000
    LABELCACHE ON
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Street 20"
      LABEL
        # must be in your FONTSET
        TYPE TRUETYPE
        FONT "vera"
        SIZE 9
        MINSIZE 1
        MAXSIZE 9
        ANGLE AUTO
       POSITION CC
       OFFSET 0 0
        COLOR 0 0 255
        MINFEATURESIZE 50
        #MINDISTANCE 10
        BUFFER 0
      END
      STYLE
        SYMBOL "point"
        SIZE 10
        MINSIZE 3
        MAXSIZE 10
        COLOR 160 160 160
      END
      STYLE
        SYMBOL "point"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        COLOR 247 193 157
      END
    END
  END
  LAYER
    NAME "street10"
    STATUS DEFAULT
    TYPE LINE
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_S10_O.TAB"
    MAXSCALE 1700000
    LABELITEM "Street_Label"
    SYMBOLSCALE 400000
    LABELMAXSCALE 500000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Street 10"
      LABEL
        # must be in your FONTSET
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 1
        MAXSIZE 8
        ANGLE AUTO
       POSITION CC
       OFFSET 0 0
        COLOR 255 0 0
        BACKGROUNDCOLOR 153 204 153
        MINFEATURESIZE AUTO
        MINDISTANCE 200
        BUFFER 1
      END
      STYLE
        SYMBOL "point"
        SIZE 10
        MINSIZE 3
        MAXSIZE 10
        COLOR 255 0 0
      END
      STYLE
        SYMBOL "point"
        SIZE 6
        MINSIZE 1
        MAXSIZE 6
        COLOR 255 255 0
      END
    END
  END
  LAYER
    NAME "train station"
    STATUS OFF
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_TRAIN_STATION.TAB"
    MAXSCALE 10000
    #LABELITEM "Label"
    SYMBOLSCALE 1000
    LABELMAXSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Train station"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 2
        MAXSIZE 8
        ANGLE AUTO
       POSITION UC
       OFFSET 0 0
      END
      STYLE
        SYMBOL "triangle"
        COLOR 153 0 0
        SIZE 8
        MINSIZE 3
        MAXSIZE 8
      END
    END
  END
  LAYER
    NAME "bus station"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_BUS_STATION.TAB"
    MAXSCALE 10000
    LABELITEM "Label"
    SYMBOLSCALE 1000
    LABELMAXSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "bus station"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 2
        MAXSIZE 8
        ANGLE AUTO
       POSITION UC
       OFFSET 0 0
      END
      STYLE
        SYMBOL "triangle"
        COLOR 0 153 0
        SIZE 8
        MINSIZE 3
        MAXSIZE 8
      END
    END
  END
  LAYER
    NAME "LOCATIONS0"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_AND_LOCATIONS0.TAB"
    MAXSCALE 1000000
    LABELITEM "Name"
    SYMBOLSCALE 200000
    LABELMAXSCALE 500000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "LOCATIONS0"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 12
        MINSIZE 2
        MAXSIZE 12
        ANGLE AUTO
       POSITION AUTO
       OFFSET 0 0
       COLOR 0 0 255
      END
      STYLE
        SYMBOL "star"
        COLOR 255 0 0
        SIZE 18
        MINSIZE 8
        MAXSIZE 18
      END
    END
  END
  LAYER
    NAME "LOCATIONS1"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_AND_LOCATIONS1.TAB"
    MAXSCALE 800000
    LABELITEM "Name"
    SYMBOLSCALE 200000
    LABELMAXSCALE 500000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "LOCATIONS1"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 12
        MINSIZE 2
        MAXSIZE 12
        ANGLE AUTO
       POSITION AUTO
       OFFSET 0 0
       COLOR 0 0 255
      END
      STYLE
        SYMBOL "point"
        COLOR 153 153 0
        SIZE 8
        MINSIZE 3
        MAXSIZE 8
      END
    END
  END
  LAYER
    NAME "LOCATIONS2"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_AND_LOCATIONS2.TAB"
    MAXSCALE 800000
    LABELITEM "Name"
    SYMBOLSCALE 200000
    LABELMAXSCALE 500000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "LOCATIONS2"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 10
        MINSIZE 2
        MAXSIZE 10
        ANGLE AUTO
       POSITION AUTO
       OFFSET 0 0
       COLOR 0 0 255
      END
      STYLE
        SYMBOL "point"
        COLOR 153 153 0
        SIZE 6
        MINSIZE 1
        MAXSIZE 6
      END
    END
  END
  LAYER
    NAME "LOCATIONS3"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_AND_LOCATIONS3.TAB"
    MAXSCALE 400000
    LABELITEM "Name"
    SYMBOLSCALE 200000
    LABELMAXSCALE 200000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "LOCATIONS3"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 10
        MINSIZE 2
        MAXSIZE 10
        ANGLE AUTO
       POSITION AUTO
       OFFSET 0 0
       COLOR 0 0 255
      END
      STYLE
        SYMBOL "point"
        COLOR 153 51 153
        SIZE 6
        MINSIZE 1
        MAXSIZE 6
      END
    END
  END
  LAYER
    NAME "Tourist Information"
    STATUS OFF
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_TOURIST_INFORMATION.TAB"
    MAXSCALE 10000
    LABELITEM "Label"
    SYMBOLSCALE 1000
    LABELMAXSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Tourist Information"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 2
        MAXSIZE 8
        ANGLE AUTO
       POSITION UC
       OFFSET 0 0
      END
      STYLE
        SYMBOL "rectangle"
        COLOR 255 51 0
        SIZE 8
        MINSIZE 3
        MAXSIZE 8
      END
    END
  END
  LAYER
    NAME "Shopping Center"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_SHOPPING_CENTER.TAB"
    MAXSCALE 10000
    LABELITEM "Label"
    SYMBOLSCALE 1000
    LABELMAXSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "shopping center"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 10
        MINSIZE 2
        MAXSIZE 10
        ANGLE AUTO
       POSITION UC
       OFFSET 0 0
      END
      STYLE
        SYMBOL "special"
        COLOR 255 51 0
        SIZE 15
        MINSIZE 6
        MAXSIZE 15
      END
    END
  END
  LAYER
    NAME "Theater"
    STATUS DEFAULT
    TYPE POINT
    CONNECTIONTYPE OGR
    CONNECTION "CA_NAV_THEATER.TAB"
    MAXSCALE 10000
    LABELITEM "Label"
    SYMBOLSCALE 1000
    LABELMAXSCALE 5000
    PROJECTION
      "init=epsg:4326"
    END
    CLASS
      NAME "Theater"
      LABEL
        TYPE TRUETYPE
        FONT "vera"
        SIZE 8
        MINSIZE 2
        MAXSIZE 8
        ANGLE AUTO
       POSITION UC
       OFFSET 0 0
      END
      STYLE
        SYMBOL "triangle"
        COLOR 255 51 0
        SIZE 8
        MINSIZE 3
        MAXSIZE 8
      END
    END
  END
***********************

is it still possible to speed up my application?

****

 the system parameters of my application:

Windows XP professional
MS4W 4.8.1
data source -- MapInfo data

*--only CGI parameters are used,since it is a pure static version with HTML,

is it possible to develop a pure static application based on MapServer, even
in conjunction with PHP/MapScript or Chameleon?


thanks for any clues.

zhonghai

16.05.2006


On 5/15/06, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
>
> We really need more information about the nature of the data. I mean if
> you've got
> 20 layers each with a million polygons and are trying to show all of them
> then 3 seconds
> might be really fast! Also, the way you are symbolizing features may
> impact things.
>
> In my experience neither 1 or 2 is worth considering...
>
> Steve
>
> Steve
>
> >>> Zhonghai Wang <zhonghaiw at GMAIL.COM> 5/15/2006 9:15:49 AM >>>
> Hi there,
>
> for a special purpose I've developed an static version application based
> on
> MapServer CGI, which means I just use pure HTML tages for the GUI, even
> without JavaScript code snippets to validate forms.
>
> I have about 20 map layers to display according to different map scale
> (ussing the MAXSCALE, SYMBOLSCALE AND LABELMAXSCALE), there are no data
> classifications within a layer object, the status of all layers are set as
> default.
>
> I've made a test on a standalone MapServer (XP system), every request
> takes
> about 3 second. Obvioursly it's not fast enough for a web application,
> since
> there may be many users requesting the server at the same time if the
> application is published on the web.
>
> Is MapServer really so slow? can anybody give me some ideas?should I
> modify
> the mapfiles?
>
> I am wondering whether the following solutions will work:
> 1. define every layer as a seperate mapfile, and  combine them together by
> request
> 2. turn off the non-displayed layers off on the fly
>
> are these possible to speed up MapServer performance?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060516/46e7f75f/attachment.htm>


More information about the MapServer-users mailing list