MapServer Performance Tips

Timothy J Nolte tnolte at ILPCS.COM
Tue Aug 7 11:09:07 PDT 2007


On Tue, 7 Aug 2007 11:33:10 -0600, Gregor Mosheh <gregor at HOSTGIS.COM> wrote:

>Did you shptree all of the shapefiles, including the tileindex? That can
>help a lot. There's also "sortshp" which physically sorts the file so
>that seeks aren't as random. (I should add that to the page.)

I have run shptree and all the shapefiles and the tileindex. I saw sortshp
but I might need to visit that and see about how I can perhaps sort the
shapefiles. Would that be usable on the tileindex or just the individual shapes.

>Beyond that, it's hard to give any specific advice without any specific
>details. Are you experiencing a problem with speed, or just looking to
>make fast even faster? Is a specific layer being problematic? Could you
>perhaps make the expressions more efficient, maybe merge some layers
>together using expressions? (you had said that you broke it into layers
>by expression, thought I'd ask)

I don't think the current performance is even close to fast. I'm trying to
make what seems to be slow at least acceptable. The biggest performance hit
seems to come from the tileindex'd shapefile layer I was talking about.
Here's the layer setup that I have.

  # ==============================================
  # Layer: Propagations
  # ==============================================
  LAYER
    GROUP "Propagations"
    NAME "-98db to -104db"
    STATUS DEFAULT
    TILEINDEX "propagations/tileindex"
    TILEITEM "location"
    TYPE POLYGON
    # --------------------------------------------------
    # Class: -98db to -104db
    # --------------------------------------------------
    CLASS
      NAME "-98db to -104db"
      EXPRESSION ([LOWER] >= -104 AND [UPPER] <= -98)
      MINSCALE 0
      MAXSCALE 1200000
      STYLE
        COLOR 255 128 0
        OUTLINECOLOR 255 128 0
      END
    END
  END

  LAYER
    GROUP "Propagations"
    NAME "-94db to -98db"
    STATUS DEFAULT
    TILEINDEX "propagations/tileindex"
    TILEITEM "location"
    TYPE POLYGON
    # --------------------------------------------------
    # Class: -94db to -98db
    # --------------------------------------------------
    CLASS
      NAME "-94db to -98db"
      EXPRESSION ([LOWER] >= -98 AND [UPPER] <= -94)
      MINSCALE 0
      MAXSCALE 1200000
      STYLE
        COLOR 0 0 255
        OUTLINECOLOR 0 0 255
      END
    END
  END

  LAYER
    GROUP "Propagations"
    NAME "-89db to -94db"
    STATUS DEFAULT
    TILEINDEX "propagations/tileindex"
    TILEITEM "location"
    TYPE POLYGON
    # --------------------------------------------------
    # Class: -89db to -94db
    # --------------------------------------------------
    CLASS
      NAME "-89db to -94db"
      EXPRESSION ([LOWER] >= -94 AND [UPPER] <= -89)
      MINSCALE 0
      MAXSCALE 1200000
      STYLE
        COLOR 255 0 0
        OUTLINECOLOR 255 0 0
      END
    END
  END

  LAYER
    GROUP "Propagations"
    NAME "-84db to -89db"
    STATUS DEFAULT
    TILEINDEX "propagations/tileindex"
    TILEITEM "location"
    TYPE POLYGON
    # --------------------------------------------------
    # Class: -84db to -89db
    # --------------------------------------------------
    CLASS
      NAME "-84db to -89db"
      EXPRESSION ([LOWER] >= -89 AND [UPPER] <= -84)
      MINSCALE 0
      MAXSCALE 1200000
      STYLE
        COLOR 255 255 0
        OUTLINECOLOR 255 255 0
      END
    END
  END

  LAYER
    GROUP "Propagations"
    NAME "-84db to 0db"
    STATUS DEFAULT
    TILEINDEX "propagations/tileindex"
    TILEITEM "location"
    TYPE POLYGON
    # --------------------------------------------------
    # Class: -84db to 0db
    # --------------------------------------------------
    CLASS
      NAME "-84db to 0db"
      EXPRESSION ([LOWER] >= -84 AND [UPPER] <= 0)
      MINSCALE 0
      MAXSCALE 1200000
      STYLE
        COLOR 128 255 0
        OUTLINECOLOR 128 255 0
      END
    END
  END


Let me know if anything looks bad. Perhaps you can give me a suggestion on
how I might need to sortshp to give me the best performance with this.



More information about the MapServer-users mailing list