Is MapServer Thread-safe?

Ed McNierney ed at TOPOZONE.COM
Tue Jan 22 22:13:42 EST 2008


Adrian -

 

My first reaction is to wonder why you feel you need MapScript (which
leads to the whole issue of thread safety in the first place).  I would
be inclined to build your application as I have done others, using the
.NET/C# environment to process Web requests and then compute an
appropriate WMS request to render the map image required.  You would use
MapServer in simple CGI/WMS mode, sending HTTP requests for images which
you then retrieve in your C# code and embed in an output page of your
design.

 

Your user activity seems quite high; an average 10-minute session with
an average 7-second wait between map requests would mean the average
visit requested 85 map views.  That's a very high number!  Just as a
data point, users on my TopoZone site average about 30 seconds per map
view (and no, that's not because the maps are slow to load <g>).  Users
tend to navigate quickly, panning and zooming and selecting layers to
get something they want - and then they actually want to take a moment
to look at it.

 

Shapefiles, properly organized, are almost certainly the fastest storage
option in terms of retrieval.  However, I don't know how often those
data sets change.  If your data changes with any frequency, you will
need to either automate the data-organization steps to update the
shapefiles, or store your data in a database.  Don't just put static,
simple data into a database if you're not going to otherwise use the
database's capabilities.

 

-          Ed

 

Ed McNierney

Chief Mapmaker

Demand Media / TopoZone.com

73 Princeton Street, Suite 305

North Chelmsford, MA  01863

Phone: 978-251-4242, Fax: 978-251-1396

ed at topozone.com

 

From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of adrian kruk
Sent: Tuesday, January 22, 2008 11:04 AM
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] Is MapServer Thread-safe?

 

Perphaps some results from mapscript performance tests would be helpful
for me. 
Here is some details as you wish:

Environment:
QA Server:  2x3GHz Pentium (PRD: 4 - 8 processors) 
Application Server: IIS 5.0/6.0
Memory: 3GB
OS: WinXP or 2003 Server
Technology: .NET/C#
Application type: webservice

Data: 
Map of Poland, shapefiles, above layers: 
roads ( 600k polylines, categorized by attribute in table), 
railroads (2K polylines)
towns: (60K points, 3K polygons)
some adminitration districts (regions, subregions, etc, summary:
10Kpolygons in 3 layers)
forest, parks,etc (30K polygons)
lakes and rivers ( 21K polylines, 7K polygons)

Additional layers: 
Labels of almost each layer in good quality (antialiasing) - visible
depends on scale.
Some data from my business client (could be e.g. 100K polygons in 3
layers)

Example application: 
Performance requirement: 1000 users sessions/hour.
Users session definition:
Session time: few random (avg. 10) minutes with doing actions zooming,
changing coverage,  on/off layers, etc.
Between actions user waits for avg 7 secs. 

WebService provide below functionality:
each user has its own map in session (will consider map pooling), data
filtering (by atributes)
High quaility images like "maps.google.com " but one image with 800x600
resolution

WebService methods:
bytes[] GetImage(sessionID) - getting image

SetZoom(sessionID, int zoom)
SetRectangle(.....
SetCenter
SetMapSize  (default 800x600) 
SetLayerVisibility(sessionID, layerid, bool visibility)
PutSymbol( x,y, symbolID)
GetLegend
GetLayerAtributes
DrawLayerFiltered(sessionID, query) - drawing in memory, image with new
layer will be returned by GetImage 
...
GetZoom,
GetCenter
etc.....


Can mapscript do it (quality and performance)? 
How to store data: shapefiles or postgis? Maybe use 2 or 3 harddiscs if
it will increase performance?
What about connection pooling to postgis, mapserver has one connection
per process or more?

Please send be some advice, I will be very graceful. 


Best Regards,
Adrian



2008/1/22, Ed McNierney <ed at topozone.com>:

Adrian -

Well, what really matters is what "many" means to YOU and your
application; my MapServer applications are probably quite different from
yours, so if I have 2,000 simultaneous users that doesn't really tell
you anything.  If you can describe it in as much detail as possible,
then it will make it much easier for us to give you advice.  There are
quite a few serious production implementation of both MapServer CGI and
MapScript applications.  And, as Dan correctly points out, a different
tool might be even better for you. 

     - Ed

Ed McNierney
Chief Mapmaker
Demand Media / TopoZone.com
73 Princeton Street, Suite 305
North Chelmsford, MA 01863
ed at topozone.com
Phone: +1 (978) 251-4242 
Fax: +1 (978) 251-1396

-----Original Message-----
From: UMN MapServer Developers List [mailto:MAPSERVER-DEV at LISTS.UMN.EDU]
On Behalf Of Adrian Kruk
Sent: Tuesday, January 22, 2008 9:37 AM 
To: MAPSERVER-DEV at LISTS.UMN.EDU
Subject: Re: [UMN_MAPSERVER-DEV] Is MapServer Thread-safe?

>Why do you think this is a "big limitation"?  There are many MapServer 
users, >myself included, running MapServer as a CGI application -
including
as a WMS >server - with "many clients running simultaneously".

What does mean "many" for you?

>What kind of equipment are you using and what kind of user load do you 
expect?  >It sounds like you have concluded that a standard CGI WMS
application of >MapServer is simply unsuitable for you, and I haven't
seen
information that >explains why you think that.

WMS is ok, but I need C# API to create any gis application ( e.g. with
adding/modyfing spatial features, with requested by bussiness client
webservice interface, etc).

The problem is with scalability with using mapscript. Changing server
from 1
processor architecture to 4 performance will increase performance but I 
think that not much in really big workload.




-- 
Pozdrawiam,
Adrian Kruk 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20080122/c4927496/attachment.html


More information about the mapserver-dev mailing list