<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7652.24">
<TITLE>RE: [UMN_MAPSERVER-USERS] System Configuration</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Many good questions. I will see if I can catch them all. A bit on the nature of the application.</FONT></SPAN>
</P>

<UL>
<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">We are only using vector data (we assumed that the raster would slow it down).</FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">We are serving many different maps stored separately with the same composition of layers. Each map has 6 layers (4 polygon and 2 point layers for labeling). </FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Each of the different map sets has differing quantities of features.&nbsp; For the most significant layers they average around 10,000 features but may be as high as 100,000. </FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">A majority of the requests are to display a small area of one of the maps so the rendering focuses in to a few features.&nbsp; The user will query a database which will allow for viewing the map that is zoomed to the area of interest.</FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">No layer reprojecting (we assumed this would also slow it down).</FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">The output map is PNG with dimensions 419 X 403.</FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">We are using PHP_mapscript to generate the requests.&nbsp; The parameters for the map generation come from a database and the user requested location.&nbsp; So there are a few lines of code to find the location on the map and generate the images.</FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">The mapfile contains about 12 layers.&nbsp; Several layers to display the primary polygon layer thematically and a couple extra to show the polygons with outlines. </FONT></SPAN></LI>

<LI><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Data is stored in Shapefiles</FONT></SPAN></LI>
<BR>
</UL>
<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I made attempts to stream-line the use of extra features to ensure the speed.&nbsp; I certainly may be using items that hurt instead of help.&nbsp; Here is the mapfile.&nbsp; Now that I look at the mapfile there may be a couple items that I originally had intended to use but are now just relics and time wasters.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT FACE="Arial" SIZE=2 COLOR="#000000"> &lt;&lt;postforwebforum.map&gt;&gt; </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Now as for the users.&nbsp; We are assuming 5000 simultaneous - all at the same instant. This would assume a substantially larger group of users accessing the site at the same time.&nbsp;&nbsp; We assume this to be the peak stress for Stage 1 of the app.&nbsp; </FONT></SPAN></P>
<BR>
<BR>
<BR>
<BR>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Bruce -</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">My channeling sensors went off when Frank rang &lt;g&gt;.</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">It is certainly true that a bit of experience and contemplation can help you discover optimization opportunities that aren't immediately self-evident.&nbsp; Can you describe the nature of your map application?&nbsp; Are you using raster data, vector data, or both?&nbsp; What size is your data, in numbers of features and/or files?&nbsp; What kind of disk subsystem is being used?&nbsp; Is there layer reprojection going on?</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Generalizations are rarely helpful (except for this one).&nbsp; It's like being told the average man is 5' 7&quot; tall - it tells you nothing about how tall I am.&nbsp; MapServer performance depends on a number of factors, but the best place to start is a detailed understanding of what exactly you're trying to do with MapServer.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">It would be most helpful to us if you could post your map file and a sample URL request, preferably one that is externally (publicly) visible.&nbsp; And can you define what you mean by &quot;simultaneous&quot; users?&nbsp; Do you mean 5,000 map requests all being generated at exactly the same time?&nbsp; Or do you mean 5,000 human users asking for a new map every X seconds or so?&nbsp; And if the latter, what value are you using for X?</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp; - Ed</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Ed McNierney</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Chief Mapmaker</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Demand Media / TopoZone.com</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">73 Princeton Street, Suite 305</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">North Chelmsford, MA  01863</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Phone: 978-251-4242, Fax: 978-251-1396</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">ed@topozone.com</FONT></SPAN>
</P>
<BR>
<BR>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">-----Original Message-----</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">From: UMN MapServer Users List [</FONT></SPAN><A HREF="mailto:MAPSERVER-USERS@LISTS.UMN.EDU"><SPAN LANG="en-us"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">mailto:MAPSERVER-USERS@LISTS.UMN.EDU</FONT></U></SPAN></A><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">] On Behalf Of Frank Warmerdam</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Sent: Wednesday, November 07, 2007 8:26 PM</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">To: MAPSERVER-USERS@LISTS.UMN.EDU</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Subject: Re: [UMN_MAPSERVER-USERS] System Configuration</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Bruce Cheney wrote:</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; We have been given a requirement to support 5000 simultaneous users.&nbsp;&nbsp; </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; What we are finding is that MapServer bogs down around 400 </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; simultaneous users on a test machine.&nbsp; It looks like it is likely </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; slowing because of the threading issue.&nbsp; We haven't tested on a </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; production machine but are estimating that it should support double </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; what are test machine could handle (double the processor and RAM).&nbsp; So </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; at least 800 simultaneous users.&nbsp; Divide that out with the 5000 and we </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; need a minimum of 6-7 web servers supporting MapServer.&nbsp; We will </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; certainly scale this as is needed but I do need some idea going in as to what is going to be required.</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Bruce,</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I'm curious how many map requests per minute you expect 800 simultaneous users to generate.</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; Does this sound like results that others expect or is this quantity </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; above what others have tested?&nbsp; Also Does anyone know of a solution in </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; the works to run make mapserver thread safe and/or up the overall </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; speed?&nbsp; I am not complaining about the speed just wondering what is in </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&gt; the works.</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">In various aspects MapServer is already thread safe though there are also known &quot;unsafe&quot; components, and some components are wrapped by big locks that significantly reduce the value of multiple threads.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Progress occurs by fits and starts, largely based on support from user organizations depending on multi-threading.&nbsp; For instance, in 5.0 I implement locking around OGR for a client of mine in Australia.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">(This is a subtle way of suggesting you hire someone to make this happen if it is what you want!)</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">All this aside, by default MapServer is *massively multi-threaded*.</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I say this since the default operation is to start a new cgi instance for each request - each is essentially an independent thread.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Of course, the downside of whole-process cgi style multithreading is that very little context is preserved from request to request.&nbsp; Map files, data file headers, etc all need to be reparsed for each request.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">My point here is that you need to think carefully about the application flow to take much advantage of multiple threading within a single process.</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Also, if I may channel Ed, if you wanted to squeeze more performance out of mapserver, you really need to start by figuring out what it is spending it's time doing.&nbsp; Where is it spending it's time?</FONT></SPAN></P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&nbsp; o waiting for disk?&nbsp; (perhaps you are reading more data than you need?)</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&nbsp; o rendering (perhaps your data is overdense, or you are using expensive</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; rendering options?)</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">&nbsp; o parsing mapfiles (perhaps you mapfile has too many unused layers?) etc.</FONT></SPAN>
</P>

<P><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">Best regards,</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">-- </FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">---------------------------------------+--------------------------------</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">---------------------------------------+------</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">I set the clouds in motion - turn up&nbsp;&nbsp; | Frank Warmerdam, warmerdam@pobox.com</FONT></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">light and sound - activate the windows | </FONT></SPAN><A HREF="http://pobox.com/~warmerdam"><SPAN LANG="en-us"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://pobox.com/~warmerdam</FONT></U></SPAN></A><SPAN LANG="en-us"></SPAN>

<BR><SPAN LANG="en-us"><FONT SIZE=2 FACE="Arial">and watch the world go round - Rush&nbsp;&nbsp;&nbsp; | President OSGeo, </FONT></SPAN><A HREF="http://osgeo.org"><SPAN LANG="en-us"><U><FONT COLOR="#0000FF" SIZE=2 FACE="Arial">http://osgeo.org</FONT></U></SPAN></A><SPAN LANG="en-us"></SPAN>
</P>

</BODY>
</HTML>