AnsweredAssumed Answered

How to use multiple Map Service instances with PopulateFromServiceAsync

Question asked by larson_devnetinc on Apr 5, 2019

Hello All,

 

I have been having problems displaying features when navigating a map in a .NET application in real time. The map has 2 layers that use the same map service, but use different renderers. At some extents, the map will take over a minute to display even one of the layers, and upon further inspection, it seems that in the case of approximately 7,000 features being visible at tht viewpoint, the ServiceFeatureTable is being populated with 40,000 features per layer. It makes the map feel very slow, especially because it only draws the features on the map all at once, rather than as they are available.

 

I was comparing the performance of my map with the webmap that it references in the ArcGIS Online Map Viewer, and in the Map Viewer, it displays only the features in the visible area and they are displayed as they load. I wrote some test code to see if I could mimic this behavior by calling a function when map navigation completes that populates the ServiceFeatureTables of the layers (in manual cache mode) using the current visible area. I divide the extent into 6 blocks and for each layer, I create 6 threads and call PopulateFromServiceAsync from each one. This is able to successfully populate the tables and display them properly, and given that it only loads the necessary features, it runs significantly faster than the OnInteraction FeatureRequestMode. However, it appears that the threads execute in parallel, but the results from the PopulateFromServiceAsync calls come in sequentially. I monitored the "Instances in Use" of the map service that these layers use, and it seems that when it is populating the tables, it is not using multiple instances. When I monitored the same service when panning in the ArcGIS Online Map Viewer, I saw that the service was using all the Instances that it has been allocated to use. 

 

Is there any way that I could actually run PopulateFromServiceAsync in parallel?

 

Thanks,

Keith

Outcomes