Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Implement trackpoints API call in cgimap #3125

Closed
openstreetmap-trac opened this issue Jul 23, 2021 · 6 comments
Closed

Implement trackpoints API call in cgimap #3125

openstreetmap-trac opened this issue Jul 23, 2021 · 6 comments

Comments

@openstreetmap-trac
Copy link

Reporter: amm
[Submitted to the original trac issue database at 2.35pm, Friday, 16th July 2010]

Given that cgimap appears to work quite well for the map call and saves quite a few resources on the rails servers, I wanted to extend cgimap to some of the other API calls.

This is an initial proof of concept implementation of the gps trackpoints api call to get some opinions of if this is a viable way.

I think, the attached patch should mostly work, however it is only very lightly tested, as I don't have more than a few gpx tracks in my testing db. There are also a couple of known issues: Formost, it does not yet switch between call types and one has to specify at time of start if it should server map calls, or trackpoints calls. Also the privacy settings of the tracks are possibly not quite correct yet. However, both should be fairly easily fixed.

Doing some initial benchmarking, it appears to again have about a factor of 10 wall clock speedup compared to the rails_port (on a cache hot (nearly empty) database). It shifts from mostly rails cpu dominated to more or less postgresql cpu dominated.

If the trackpoints call is in anyway a bottleneck currently I can obviously not say (that would need some rails log analysis to see where most of the resources are used), but it was the easiest call to implement and can't really harm either.

As said earlier, I am throwing this patch out there for discussion if we should move more of the API into the C backend and what the best approach would be.

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 4.16pm, Saturday, 17th July 2010]

I've only had a quick look at the patch, but it looks like you've added a switch that makes it startup in a different mode where all it does is trackpoints queries.

My plan had always been to add some code to the top level loop to inspect the URL and work out which call it was being asked to process so we can just run one set of daemons that can handle anything.

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 4.25pm, Saturday, 17th July 2010]

That's correct. But it wasn't intended to stay that way. I remember having a conversation with Matt about how best to handle this, but I can't remember if there was a conclusion and what it was, so I simply did it via a switch for the moment. The code presumably also needs a bit more refactoring to separate out the generic parts from the call specific parts.

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 5.44pm, Friday, 23rd July 2010]

Ok, I have now changed it so that it looks at the request URI, so both the map and trackpoints call can be handled by the same daemons.

I think I have also now corrected what I believe is the correct handling of the public / private / trackable / identifiable properties.

So I think this patch now does the right thing now... However, I still haven't tested it thoroughly for a lack of a test db with a reasonable number of traces included.

I have successfully run it through apache bench (100.000 identical requests), so hopefully it at least doesn't leak any memory are have stability issues.

The patch is on top of the first patch, but I can colapse it into a single patch if wished.

@openstreetmap-trac
Copy link
Author

Author: TomH
[Added to the original trac issue at 5.57pm, Friday, 23rd July 2010]

Would it not be easier to fork the git repo and do your work there? Either the master one at http://git.openstreetmap.org/cgimap.git or zere's one on github.

@openstreetmap-trac
Copy link
Author

Author: amm
[Added to the original trac issue at 9.26am, Saturday, 31st July 2010]

I have now forked zere's github branch and pushed it there. ( http://github.com/apmon/openstreetmap-cgimap/ )

I have also added an initial implementation of the relations/:id/full call

@openstreetmap-trac
Copy link
Author

Author: mmd
[Added to the original trac issue at 4.23pm, Tuesday, 19th May 2020]

CGImap has changed quite a bit during the last 10 years, so the patch wouldn't apply without some major overhaul. I believe it would be better to just rewrite it from scratch.

Follow up is here: zerebubuth/openstreetmap-cgimap#230

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant