<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic calling AGSRouteTask.solve in Parallel (IOS) in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/calling-agsroutetask-solve-in-parallel-ios/m-p/584621#M5050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using Online services to fetch routes. We have an application where we find etas and routes in parallel for multiple locations. Some of the locations are far off, and we see&amp;nbsp;that Route comes after a long time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we are trying to solve many routes in parallel, we find that RouteTask is taking time (especially with far away locations)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set of Questions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there away to execute RoueTasks in parallel?&lt;/LI&gt;&lt;LI&gt;Is it possible to prioritise among the parallel RouteTasks? Is there a way to run them in separate AGSOperationQueue?&lt;/LI&gt;&lt;/UL&gt;&lt;UL&gt;&lt;LI&gt;For some routes we only want ETAs, what should be the default params for only fetching ETAs without directions and rest of the details?&lt;/LI&gt;&lt;LI&gt;We have created separate RouteTasks for etas and calculation of detail routes - This is not helping our case.&amp;nbsp;What could be the reason?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Sep 2019 17:45:16 GMT</pubDate>
    <dc:creator>RAMESHBACHIRAJU</dc:creator>
    <dc:date>2019-09-19T17:45:16Z</dc:date>
    <item>
      <title>calling AGSRouteTask.solve in Parallel (IOS)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/calling-agsroutetask-solve-in-parallel-ios/m-p/584621#M5050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We are using Online services to fetch routes. We have an application where we find etas and routes in parallel for multiple locations. Some of the locations are far off, and we see&amp;nbsp;that Route comes after a long time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When we are trying to solve many routes in parallel, we find that RouteTask is taking time (especially with far away locations)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Set of Questions&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is there away to execute RoueTasks in parallel?&lt;/LI&gt;&lt;LI&gt;Is it possible to prioritise among the parallel RouteTasks? Is there a way to run them in separate AGSOperationQueue?&lt;/LI&gt;&lt;/UL&gt;&lt;UL&gt;&lt;LI&gt;For some routes we only want ETAs, what should be the default params for only fetching ETAs without directions and rest of the details?&lt;/LI&gt;&lt;LI&gt;We have created separate RouteTasks for etas and calculation of detail routes - This is not helping our case.&amp;nbsp;What could be the reason?&lt;/LI&gt;&lt;/UL&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 17:45:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/calling-agsroutetask-solve-in-parallel-ios/m-p/584621#M5050</guid>
      <dc:creator>RAMESHBACHIRAJU</dc:creator>
      <dc:date>2019-09-19T17:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: calling AGSRouteTask.solve in Parallel (IOS)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/calling-agsroutetask-solve-in-parallel-ios/m-p/584622#M5051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ramesh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some answers for you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;OL style="border: 0px; padding: 0px 0px 0px 30px;"&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.5ex 0px;"&gt;Is there a way to execute RoueTasks in parallel?&lt;BR /&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; This should be the default behavior. Create a single &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_task.html"&gt;&lt;STRONG&gt;AGSRouteTask&lt;/STRONG&gt;&lt;/A&gt;, and call &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_task.html#ad604cb53da380041479b2daf9d66b82c"&gt;&lt;STRONG&gt;solve()&lt;/STRONG&gt;&lt;/A&gt; multiple times. &lt;SPAN style="text-decoration: line-through;"&gt;These operations will be run on the shared &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_operation_queue.html"&gt;&lt;STRONG&gt;AGSOperationQueue&lt;/STRONG&gt;&lt;/A&gt; which is by default configured to allow unlimited concurrent&amp;nbsp;operations (see &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_operation_queue.html#a7c9eee5504aab1fd62cbc4ee02e712d3"&gt;&lt;STRONG&gt;maxConcurrentOperationCount&lt;/STRONG&gt;&lt;/A&gt;).&lt;/SPAN&gt;&amp;nbsp;&lt;STRONG&gt;Correction&lt;/STRONG&gt;: We use&amp;nbsp;an internal queue &lt;STRONG&gt;per host&lt;/STRONG&gt; that is configured to allow &lt;A href="https://developer.apple.com/documentation/foundation/urlsessionconfiguration/1407597-httpmaximumconnectionsperhost"&gt;as many concurrent sessions as NSURLSessionConfiguration allows&lt;/A&gt; (we set this to 6). This enables&amp;nbsp;us to avoid triggering&amp;nbsp;timeouts at&amp;nbsp;the NSURLSession level if a lot of requests are sent at once.&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.5ex 0px;"&gt;Is it possible to prioritise among the parallel RouteTasks? Is there a way to run them in separate &lt;STRONG&gt;AGSOperationQueue&lt;/STRONG&gt;?&lt;BR /&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; The prioritization for parallel requests would need to be&amp;nbsp;on the service side, and that behavior is not exposed. But in terms of the requests you make, they are queued up and kicked off in the order they are submitted.&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.5ex 0px;"&gt;For some routes we only want ETAs, what should be the default params for only fetching ETAs without directions and rest of the details?&lt;BR /&gt;&lt;STRONG&gt;A:&lt;/STRONG&gt; Get the &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_task.html#aee9a94eada6ddbab8f033a31644e212d"&gt;default parameters&lt;/A&gt; as usual, and then you should set&amp;nbsp;&lt;STRONG&gt;&lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_parameters.html#accdfdff22e4035f4239fb6425291bda7"&gt;returnDirections&lt;/A&gt;&lt;/STRONG&gt; to &lt;STRONG&gt;false&lt;/STRONG&gt;, and &lt;STRONG&gt;&lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_parameters.html#ab13348a9aea31b336f6fbedbdafedbc7"&gt;routeShapeType&lt;/A&gt;&lt;/STRONG&gt; to &lt;STRONG&gt;.none&lt;/STRONG&gt;. Note that &lt;A href="https://developers.arcgis.com/ios/latest/api-reference/interface_a_g_s_route_task.html#aee9a94eada6ddbab8f033a31644e212d"&gt;&lt;STRONG&gt;defaultRouteParametersWithCompletion()&lt;/STRONG&gt;&lt;/A&gt; caches results for a given route service, so is very fast to run once the service has been loaded (either explicitly with &lt;STRONG&gt;load()&lt;/STRONG&gt; or on first use).&lt;/LI&gt;&lt;LI style="border: 0px; font-weight: inherit; margin: 0.5ex 0px;"&gt;We have created separate RouteTasks for etas and calculation of detail routes - This is not helping our case.&amp;nbsp;What could be the reason?&lt;BR /&gt;&lt;STRONG&gt;A:&amp;nbsp;&lt;/STRONG&gt;The NSURLSessionConfiguration per host constraint is&amp;nbsp;the limiting factor here. If you create multiple RouteTasks pointing to the same URL, NSURLSession will still limit the total number of concurrent requests to that service. So&amp;nbsp;from an implementation perspective, assuming you're using the World Routing Service, a single &lt;STRONG&gt;AGSRouteTask&lt;/STRONG&gt; should suffice. What's important is the &lt;STRONG&gt;AGSRouteParameters&lt;/STRONG&gt;&amp;nbsp;you pass in when you call &lt;STRONG&gt;solve()&lt;/STRONG&gt;. You could create two separate template parameters (one for ETA and one for detailed directions) and use copies of those with appropriate stops assigned. But as mentioned above, getting the default parameters is a very lightweight operation.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I recommend you take a moment to read this page:&amp;nbsp;&lt;A href="https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-ios/blog/2019/01/19/threading-and-the-ios-runtime-sdk"&gt;https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-ios/blog/2019/01/19/threading-and-the-ios-runtime-sdk&lt;/A&gt;&amp;nbsp;- it will give you a good idea of how the iOS Runtime handles threading (by default it will&amp;nbsp;generally&amp;nbsp;do what you want it to&amp;nbsp;and&amp;nbsp;get out of your way, performing things in the background).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does that help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Sep 2019 19:21:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/calling-agsroutetask-solve-in-parallel-ios/m-p/584622#M5051</guid>
      <dc:creator>Nicholas-Furness</dc:creator>
      <dc:date>2019-09-19T19:21:21Z</dc:date>
    </item>
  </channel>
</rss>

