[Mapguide-trac] [mapguide-trac] #2194: http responses involving reader objects should be streamed out

MapGuide Open Source trac_mapguide at osgeo.org
Mon Dec 3 20:30:59 PST 2012


#2194: http responses involving reader objects should be streamed out
-------------------------+--------------------------------------------------
   Reporter:  jng        |       Owner:  jng
       Type:  defect     |      Status:  new
   Priority:  medium     |   Milestone:  2.5
  Component:  Map Agent  |     Version:     
   Severity:  major      |    Keywords:     
External_id:             |  
-------------------------+--------------------------------------------------
 Similar to #1070, if you look at the response handler implementation of
 the cgi, apache and isapi agents, you will see that any http request that
 returns a reader object gets ToXml() called on it.

 Look at the ToXml() implementation of any reader class and you'll see they
 effectively buffer out the entire contents of that reader to an
 intermediate string, before that intermediate string is written out the
 http response stream.

 This is an inefficient way to write out reader responses because if we
 happen to do a large feature query (eg. from WFS or SELECTFEATURES),
 there's a chance we'll be hitting the internal buffer limit of the default
 MgByteSource/MgByteReader implementations (as is the case for #1070).
 Raising the buffer limit  is just sweeping this problem under the carpet.

 Instead for requests that return reader objects, we should be writing out
 each individual records out to the http response stream '''as we iterate
 through the reader'''. This way no internal buffering is done and for
 really large query responses, there won't be any sharp memory spikes or
 chances of internal buffer limits being breached as a result.

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/2194>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list