-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Processing large volumes of TraFF messages massively slows down Navit #815
Comments
Tested with a feed of 443 messages (with events relevant for Navit so they will not get discarded immediately). Original processing time (on startup) is around 3 minutes. The geographic area originally was 1000 m around the enclosing rectangle of the endpoints. Reducing that to 100 m shaves a few seconds off the processing time (somewhere around 15 seconds for the whole feed). The padding is necessary to match locations with a Constraining the search by tile level (the one which corresponds to the road level below the one indicated) had no measurable effect. Constraining the route graph to certain types (no more than one level below the target road level if that is Altogether, the 443-message feed which previously took some three minutes to process now takes up some 80 seconds. That is still a lot, but much better than before. |
Another approach to improve performance would be lazy matching: Locations are matched to the map only when a part of the map is queried that overlaps with their search rectangle (enclosing rectangle of all points plus padding). When a location is added, a redraw is triggered anyway (which results in a map query for the location being displayed); we would additionally need to check if a route is active and “tickle” its map rectangles on the traffic map in order for those locations to get resolved. |
…and for the test interface, we need to match all locations if we are to export them to GPX. |
#822 implements lazy location matching. No “tickling” of map rectangles; new messages have their location expanded immediately when they are found to overlap with the selection of the active route. |
In the meantime, #822 has been extended to cache items upon resolving a location, and to restore these items on startup if they still correspond to map items (the latter may not be the case if the map has changed). If cached items are found to be stale (i.e. map data has changed since), they are discarded and will be regenerated from scratch the next time they are needed. That implements almost all of the proposed features:
The only remaining feature is multithreading, which is a separate issue (#760). Therefore this can be closed as soon as #822 is sufficiently tested and merged. |
So far, the only real-world use case for traffic in Navit relied on TMC. Even at busy times, there would usually be no more than around 150 active messages, most of which would expire after an hour. This does cause some delays on startup, which can be annoying but is still manageable.
Now I have built another source, which gets its messages from the Internet, as many as 300 in one shot and some 600 active messages. (This can be controlled by enabling only the sources the user requires, but these values are typical for Poland and Lithuania together, needed when traveling in the border area.)
With that volume of data, Navit slows down to the point of being unusable for several minutes after startup. When a feed is received I expect similar effects, unless most of the messages are already in cache with the same location.
I see the following ways to address this:
MOTORWAY
, we may consider ramps as well as trunk and primary roads, but not service roads): smaller route graph to examineThe text was updated successfully, but these errors were encountered: