I'm taking the printf method below - except streaming out using the apache module interface rather than stdout. I'm also streaming as much stuff from the db as possible (nodes, ways, . However I believe for the map query there's a trade-off between local process memory usage and minimising db queries: For instance when outputting the ways, one can either have previously built up a local dictionary of way ids to way tag key-value pairs, or one can query the db each time for the tags for each way. I've chosen the former - because in C/C++ I think the overhead of storing the strings locally is fairly minimal.<br>
<br>Should have an example C++ api serving from an apache module online soon.<br><br>Alex<br><br><div class="gmail_quote">2008/5/30 Raphaël Jacquot <<a href="mailto:sxpert@sxpert.org">sxpert@sxpert.org</a>>:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">Joachim Zobel wrote:<br>
> Am Montag, den 26.05.2008, 15:07 +0100 schrieb Tom Hughes:<br>
>> The reason is that we have to allow about 600Mb or so for each call<br>
>> and that quickly mounts up as you try and add extra simultaneous<br>
>> accesses.<br>
><br>
> If _that_ amount of memory is needed this probably means the XML is<br>
> build in memory. This could be done the SAX way instead.<br>
<br>
<br>
</div>considering how simple the xml is, it could probably be done the printf<br>
way, that sure would make it less memory abusive.<br>
one thing that it may be doing, is getting *all results* in one go from<br>
the database server, instead of one result at a time, resulting in<br>
having the entire set of data in the web server's machine memory at some<br>
point.<br>
requesting one row at a time *will* result in instant memory consumption<br>
cutoff and won't have any effet on the database server, which is much<br>
better at handling this sort of thing (it can handle the same row in ram<br>
for various requests at the same time)<br>
<br>
> Sincerely,<br>
> Joachim<br>
<br>
raphael<br>
(who now works on seismic data sets...)<br>
<div><div></div><div class="Wj3C7c"><br>
<br>
_______________________________________________<br>
dev mailing list<br>
<a href="mailto:dev@openstreetmap.org">dev@openstreetmap.org</a><br>
<a href="http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev" target="_blank">http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev</a><br>
</div></div></blockquote></div><br>