Implement trackpoints API call in cgimap
|Reported by:||amm||Owned by:||rails-dev@…|
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.