Calculate route takes upwards of 40 seconds

This forum deals with any kind of routing computation whether it is simple A:B-routing, calculation of isochrones, simple matrix computation or nearest search.
Post Reply
Dobos Ionut
Posts: 25
Joined: Tue Dec 03, 2019 11:27 am

Calculate route takes upwards of 40 seconds

Post by Dobos Ionut »

Hello,

We are integrating with the xserver2 service to calculate the route and have this request

Code: Select all

array:6 [
  "resultFields" => array:5 [
    "polyline" => true
    "legs" => array:3 [
      "enabled" => true
      "polyline" => false
      "tollSummary" => true
    ]
    "toll" => array:3 [
      "enabled" => true
      "sections" => true
      "systems" => true
    ]
    "eventTypes" => array:3 [
      0 => "TOLL_EVENT"
      1 => "COUNTRY_EVENT"
      2 => "ROUTE_VIOLATION_EVENT"
    ]
    "segments" => array:3 [
      "enabled" => true
      "polyline" => true
      "featureThemeIds" => array:2 [
        0 => "PTV_SpeedPatterns"
        1 => "PTV_TrafficIncidents"
      ]
    ]
  ]
  "geometryOptions" => array:1 [
    "responseGeometryTypes" => array:1 [
      0 => "PLAIN"
    ]
  ]
  "routeOptions" => array:2 [
    "tollOptions" => array:1 [
      "useDetailedToll" => true
    ]
    "timeConsideration" => array:2 [
      "$type" => "ExactTimeConsiderationAtStart"
      "referenceTime" => "2020-04-21T16:55:59+03:00"
    ]
  ]
  "requestProfile" => array:4 [
    "featureLayerProfile" => array:1 [
      "themes" => array:2 [
        0 => array:2 [
          "id" => "PTV_SpeedPatterns"
          "enabled" => true
        ]
        1 => array:2 [
          "id" => "PTV_TrafficIncidents"
          "enabled" => true
        ]
      ]
    ]
    "routingProfile" => array:1 [
      "course" => array:2 [
        "toll" => array:1 [
          "tollPenalty" => 0
        ]
        "distanceTimeWeighting" => 90
      ]
    ]
    "vehicleProfile" => array:1 [
      "electronicTollCollectionSubscriptions" => "NONE"
    ]
    "currency" => "EUR"
  ]
  "coordinateFormat" => "EPSG:4326"
  "waypoints" => array:3 [
    0 => array:2 [
      "$type" => "OffRoadWaypoint"
      "location" => array:1 [
        "offRoadCoordinate" => array:2 [
          "x" => "26.102863317"
          "y" => "44.434272809"
        ]
      ]
    ]
    1 => array:2 [
      "$type" => "OffRoadWaypoint"
      "location" => array:1 [
        "offRoadCoordinate" => array:2 [
          "x" => "2.1700115889"
          "y" => "41.388038574"
        ]
      ]
    ]
    2 => array:2 [
      "$type" => "OffRoadWaypoint"
      "location" => array:1 [
        "offRoadCoordinate" => array:2 [
          "x" => "37.615020727"
          "y" => "55.756961791"
        ]
      ]
    ]
  ]
]
The call takes from about 40 seconds to 1min and 17 seconds tops, and earlier today we had a few timeouts in the code as well. Let us know if this is a knows issue for you guys, as it was not the case in the past and is there a way to determine more predictable if future calls result in a timeout?

Best regards,
John
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculate route takes upwards of 40 seconds

Post by Bernd Welter »

Hello John,

a quick check of the coordinates returnes a routen with several thousand kilometers length.
Not sure whether PTV_SpeedPatterns are meaningful but if I am right they cause at least a part of the trouble.

I wrote a sample application I used to pley with some of the parameters you applied (played it on PROD and TEST):
  • No additional FeatureLayers: roughly 8.5 secs
  • Only PTV_TrafficIncidents : roughly 11 secs
  • PTV_TrafficIncidents + PTV_SpeedPatterns : between 40 and 70 secs
This test is surely quite surficial but it shows the impact of the additional layers.
I will forward this post to DEV for a statement though I am sure the recommendation is "don't use SPEED PATTERNS on such an international trip).
JOhn.PNG
Best regards,
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Dobos Ionut
Posts: 25
Joined: Tue Dec 03, 2019 11:27 am

Re: Calculate route takes upwards of 40 seconds

Post by Dobos Ionut »

Hello Bernd,

Thank you for your reply. Please let us know when you hear form the dev theam if speed patterns are not supported for international trips. Also, is there any other way to determine traffic without speed patterns?

Thanks,
John
User avatar
Bernd Welter
Site Admin
Posts: 2695
Joined: Mon Apr 14, 2014 10:28 am
Contact:

Re: Calculate route takes upwards of 40 seconds

Post by Bernd Welter »

well, technically spoken PTV_SpeedPatterns work also on long distances with an known, significant impact on performance.
The question on top is "is the quality of the output meaningful? Does it make sense to predict a road condition with a local timestamp on a segment that is ten/twenty or more hours ahead of the start time?"

I'd therefore recommend to skip the PTV_SpeedPatterns (by the way: PTV_TruckSpeedPatterns) and to use some other available (and performant) approaches such as
- focus on PTV_TrafficIncidents
- combined with TimeConsiderationMode.TimeSPan
This enables you to consider current road networks if they last for a few days or more.

Feedback is welcome ;-)
Bernd
Bernd Welter
Technical Partner Manager Developer Components
PTV Logistics - Germany

Bernd at... The Forum,LinkedIn, Youtube, StackOverflow
I like the smell of PTV Developer in the morning... :twisted:
Post Reply