[mapserver-dev] Proposal for OWS Dispatch improvement

Fabian Schindler fabian.schindler at eox.at
Tue Jun 7 11:56:39 EDT 2011


All,

Since this is my first post to this list I'd like to introduce myself. I 
am working at the company EOX with Stephan Meissl (I think he is known 
as "schpidi" in the svn system). I was involved with the developement of 
the WCS 2.0 extension to MapServer, so I'm quite familiar with the OWS, 
WCS and some dependent source code files.

I would like to suggest a performance improvement for the dispatch of 
OWS requests.

The current situation is something like that:

   1. A CGI request is dispatched in the mapserv.c:main
   2. This is forwarded to the mapows.c:msOWSDispatch function.
   3. Now, for every handler, the request has to be completely parsed to
      an according parameters object.
   4. When the right handler was found, the request is processed and the
      afterward dispatch of further handlers is stopped.

In most of the cases, the parsing of the parameters within the handler 
is unnecessary, since it was the wrong handler for the requested service.
To decide if a handler can handle an OWS request, only the service-type, 
the version and the request method are needed.

I suggest to change the dispatching process in the following manner:

   1. In msOWSDispatch, a preliminary parsing function determines the
      service, version and the request from the KVP or XML request.
   2. According to these parameters the suited handler is called. If no
      handler is acceptable, the program continues as usual.

In pseudo-code, this might look something like this:

function msOWSDispatch(request)
     service, version, method := preliminaryParseRequest(request)

     if service is "WMS" then
         msWMSDispatch(request, version, method)
     else if service is "WCS" then
         msWCSDispatch(request, version, method)
     else if ...
         ...
     else if service is NULL then
         return error
     end if
end function

The benefits of this method are:

    * The request only has to be parsed once in the according handler
      function. Of course, the preliminary parsing function has to parse
      a part of the request also.
    * XML requests can be parsed to a DOM-structure (with libxml) once,
      and do not have to be created for every handler only to become
      destroyed again.
    * A lot of the program logic is currently duplicated in every
      handler. I think with the adjustments above, the code might become
      more maintainable.

Following cons have to be considered:

    * The msWxSDispatch (and msSOSDispatch) functions have to be
      adjusted. Also some legacy code can be thrown away (e.g: check if
      the service type is correct, since this was already determined on
      a higher level)


I would offer to write a patch with the above changes but first I wanted 
to know if the above changes are appreciated or if these enhancements 
are not desired.

Regards,
Fabian Schindler

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


More information about the mapserver-dev mailing list