<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas",serif;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Thanks again Steve – progress:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">$ /usr/libexec/mapserv -nh QUERY_STRING="MAP=wmst?FORMAT=image%2Fpng&LAYERS=winter1km_5min&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TIME=2020-07-23T16%3A40%3A00Z&SRS=EPSG%3A900913&BBOX=-9392582.0328932,4383204.9527744,-9236038.9989652,4539747.9867024&WIDTH=256&HEIGHT=256"
 > junk.png<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Gives the following in junk.png:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Content-type: text/html<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><HTML><o:p></o:p></p>
<p class="MsoNormal"><HEAD><TITLE>MapServer Message</TITLE></HEAD><o:p></o:p></p>
<p class="MsoNormal"><!-- MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE S<o:p></o:p></p>
<p class="MsoNormal">UPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPP<o:p></o:p></p>
<p class="MsoNormal">ORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE --><o:p></o:p></p>
<p class="MsoNormal"><BODY BGCOLOR="#FFFFFF"><o:p></o:p></p>
<p class="MsoNormal">msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.<o:p></o:p></p>
<p class="MsoNormal">msEvalRegex(): R<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-left:.5in"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">mapserver-users <mapserver-users-bounces@lists.osgeo.org> on behalf of Stephen Woodbridge <stephenwoodbridge37@gmail.com><br>
<b>Date: </b>Wednesday, July 22, 2020 at 19:53<br>
<b>To: </b>"mapserver-users@lists.osgeo.org" <mapserver-users@lists.osgeo.org><br>
<b>Subject: </b>Re: [mapserver-users] Slow and degrading performance with radar (but not satellite) on mapserver-6.0.1-3_0.el6.x86_64<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-left:.5in"><o:p> </o:p></p>
</div>
<p style="margin-left:.5in">you need to include in your QUERY_STRING=MAP=....&<o:p></o:p></p>
<p style="margin-left:.5in">it is probably hard coded in the fcgi config.<o:p></o:p></p>
<p style="margin-left:.5in">-Steve W<o:p></o:p></p>
<p style="margin-left:.5in"><o:p> </o:p></p>
<div>
<p class="MsoNormal" style="margin-left:.5in">On 7/22/2020 7:15 PM, English Paul wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p style="margin-left:.5in">So you have a complex historical "mess" and its not clear where the performance issue is. So you need to divide the problem into small problems that you can verify are or are not contributing. I would start with something like this:<o:p></o:p></p>
<p style="margin-left:.5in">Thank you – I would not have thought to try it outside of CGI entirely!<o:p></o:p></p>
<p style="margin-left:.5in">Take one slow image request and try that as cgi or cli and not fcgi and turn on debugging.<o:p></o:p></p>
<p style="margin-left:.5in">  - copy and rename you mapfile so it doesn't mess with the production requests<o:p></o:p></p>
<p style="margin-left:.5in">Not a major worry in this case – I’m working in an entirely dev environment. I did make backup copies though!<o:p></o:p></p>
<p style="margin-left:.5in">  - turn on the debugging and send it to stderr in the debug mapfile<o:p></o:p></p>
<p style="margin-left:.5in"> - you can manually run that image request from the commandline like:<o:p></o:p></p>
<p style="margin-left:.5in">if mapserv is not in your path you might need to find it and your the path to it below<o:p></o:p></p>
<p style="margin-left:.5in">mapserv -nh QUERY_STRING="everything after the ? in the original query" >junk.png 2>error.txt<o:p></o:p></p>
<p style="margin-left:.5in">-nh suppresses headers from being output before the image data<o:p></o:p></p>
<p style="margin-left:.5in">error.txt will be stderr output and should contain the debug messages<o:p></o:p></p>
<p style="margin-left:.5in">I couldn’t quite get there – which this is what I ended up running:<o:p></o:p></p>
<p style="margin-left:.5in"># /usr/libexec/mapserv -nh QUERY_STRING="FORMAT=image%2Fpng&LAYERS=winter1km_5min&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&TIME=2020-07-22T22%3A30%3A00Z&SRS=EPSG%3A900913&BBOX=-11584184.507886,4070118.8849183,-11271098.44003,4383204.9527744&WIDTH=256&HEIGHT=256"
 > junk.png 2>error.txt<o:p></o:p></p>
<p style="margin-left:.5in">I first tried it with our current map file(s), and then with MS_ERRORFILE set to stderr and DEBUG set to 5, in both cases, I got an empty error.txt, and the following in junk.png:<o:p></o:p></p>
<p style="margin-left:.5in">Content-type: text/html<o:p></o:p></p>
<p style="margin-left:.5in"> <o:p></o:p></p>
<p style="margin-left:.5in"><HTML><o:p></o:p></p>
<p style="margin-left:.5in"><HEAD><TITLE>MapServer Message</TITLE></HEAD><o:p></o:p></p>
<p style="margin-left:.5in"><!-- MapServer version 6.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=CAIRO SUPPORTS=FREETYPE<o:p></o:p></p>
<p style="margin-left:.5in">SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SU<o:p></o:p></p>
<p style="margin-left:.5in">PPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE --><o:p></o:p></p>
<p style="margin-left:.5in"><BODY BGCOLOR="#FFFFFF"><o:p></o:p></p>
<p style="margin-left:.5in">loadMap(): Web application error. CGI variable &quot;map&quot; is not set.<o:p></o:p></p>
<p style="margin-left:.5in"></BODY></HTML><o:p></o:p></p>
<p style="margin-left:.5in">I noticed that if I ran it with just -nh, I get the following:<o:p></o:p></p>
<p style="margin-left:.5in">#/usr/libexec/mapserv -nh<o:p></o:p></p>
<p style="margin-left:.5in">This script can only be used to decode form results and<o:p></o:p></p>
<p style="margin-left:.5in">should be initiated as a CGI process via a httpd server.<o:p></o:p></p>
<p style="margin-left:.5in">So maybe this older version just really doesn’t want to be run on the CLI? Or maybe I’m messing up the QUERY_STRING, or need to set the CGI variable to something as the junk.png output suggests?<o:p></o:p></p>
<p style="margin-left:.5in">Thanks again and thanks SO MUCH for the super quick reply!!<o:p></o:p></p>
<p style="margin-left:.5in">Paul<o:p></o:p></p>
<p style="margin-left:.5in"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
On 7/22/2020 1:47 PM, English Paul wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
Hi,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
   Newbie here, just got a work assignment to look into some performance issues with mapserver-6.0.1-3_0.el6.x86_64 – specifically, at one time, it rendered radar images very fast, then it degraded and seemed to consume a lot more CPU. So – the EC2 instance
 side was upgraded significantly – and it still performs badly and uses a lot of CPU. It also seems to be getting slowly worse over time (days/months, not seconds/minutes). I asked this on IRC, but it looks like email might be a better route.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  During all of this, the same mapserver instance renders satellite images quickly. These seem to be a similar, or in some cases larger size png to start with, rendered onto the same final map/size.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  So – the obvious answer is that it isn’t using the CPU to render/re-render, but rather spending it on something else – I/O most likely – eg: a network request, disk I/O, SQL query?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  The previous person working on it tried turning on debug at various levels – but unfortunately that made it even slower, making it tricky to answer “what is making it slow when debug is turned off?”<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 My first instinct was to try an strace and nothing was obvious. Next up – a flame graph from strace, and/or trying dtrace – but my understanding is that dtrace is a little weak on RHEL/CentOS/Amazon Linux 6.0 *<b>and</b>* I’m not particularly good at that.
 Also, we’re using fcgi, so attaching to the correct process is a bit tricky.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  My next instinct was to look at release notes and see if the current stable has anything fixes/improvements that directly address this – there aren’t any that are obvious to my eyes, but you developers have been busy! So many things! Including some performance
 fixes and one “significant” performance fix.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
Current config file:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
AddHandler fcgid-script fcgi<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidIPCDir /var/run/mod_fcgid<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidProcessTableFile /var/run/mod_fcgid/fcgid_shm<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidMaxProcesses 10<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidMaxProcessesPerClass 10<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidMaxRequestInMem 196608<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidInitialEnv PROJ_LIB /usr/share/proj<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
FcgidInitialEnv LD_LIBRARY_PATH "/usr/local/lib:/usr/pgsql-9.1/lib"<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
So – suggestions for my next move? I currently plan to take a quick swing at building 7.6 for RHEL 6.0, knowing there might be old libraries and whatnot that make that a non-starter. Of course – we’ve got other infra running on this same instance, so upgrading
 everything is a much bigger task.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 Strace flame graph? <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  Stretch and try dtrace?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  A better way to use debug?<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
  Something else I’m missing – eg: differences between the image types that make them perform so differently?
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
 <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
Thanks,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:.5in">
Paul<o:p></o:p></p>
</div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;margin-bottom:12.0pt;margin-left:.5in">
<o:p> </o:p></p>
<pre style="margin-left:.5in">_______________________________________________<o:p></o:p></pre>
<pre style="margin-left:.5in">mapserver-users mailing list<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></pre>
</blockquote>
</div>
<p class="MsoNormal" style="margin-left:.5in"><br>
<br>
<o:p></o:p></p>
<pre style="margin-left:.5in">_______________________________________________<o:p></o:p></pre>
<pre style="margin-left:.5in">mapserver-users mailing list<o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="mailto:mapserver-users@lists.osgeo.org">mapserver-users@lists.osgeo.org</a><o:p></o:p></pre>
<pre style="margin-left:.5in"><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><o:p></o:p></pre>
</blockquote>
</div>
</body>
</html>