[OSM-dev] C++ implementation of the API

Alex Wilson alex_wilson at pobox.com
Fri May 30 08:27:17 BST 2008

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.

Should have an example C++ api serving from an apache module online soon.


2008/5/30 Raphaël Jacquot <sxpert at sxpert.org>:

> Joachim Zobel wrote:
> > Am Montag, den 26.05.2008, 15:07 +0100 schrieb Tom Hughes:
> >> The reason is that we have to allow about 600Mb or so for each call
> >> and that quickly mounts up as you try and add extra simultaneous
> >> accesses.
> >
> > If _that_ amount of memory is needed this probably means the XML is
> > build in memory. This could be done the SAX way instead.
> considering how simple the xml is, it could probably be done the printf
> way, that sure would make it less memory abusive.
> one thing that it may be doing, is getting *all results* in one go from
> the database server, instead of one result at a time, resulting in
> having the entire set of data in the web server's machine memory at some
> point.
> requesting one row at a time *will* result in instant memory consumption
> cutoff and won't have any effet on the database server, which is much
> better at handling this sort of thing (it can handle the same row in ram
> for various requests at the same time)
> > Sincerely,
> > Joachim
> raphael
> (who now works on seismic data sets...)
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20080530/e9b09a75/attachment.html>

More information about the dev mailing list