Select to view content in your preferred language

Optimize load time of lots of feature layers

435
1
09-27-2018 02:50 PM
JeremyRoberts2
New Contributor III

So...I work for a company who has tons of inventory data. We are building a QML based app.  They have told me that 99% of the time, the user will want to always see all of our layers, whenever they navigate to a particular area.  So, we are adding all of the FeatureLayers at app startup.  There are 87 layers!  Plus, there are a ton or non-spatial data tables to do relationship queries against, etc.  The problem I am having is that it is taking around at least two minutes to load all those layers.  Some are faster than others.  But maybe 2 seconds or so for each layer and if I write to the console as each layer loads, it is sequential, about two seconds between each.  I actually had to put in a sequencer thing where it doesn't attempt all 87 at the same time because still in the console it would come back loaded one after the other, about one layer every 2 seconds and once we ended up going beyond 60 seconds, I think something was timing out and the rest stopped.  So I'd do 10, wait for completion, do another 10, etc.  Ugh.

Would decreasing the MaxRecordCount on each layer help this?  Is it trying to load the first 1000 features for each layer at app startup?

Is there some other way to multi-thread and get them to load faster?

Any suggestions on how to get the app loaded faster is appreciated.  Thanks!

0 Kudos
1 Reply
LucasDanzinger
Esri Frequent Contributor

You could consider setting the feature cache mode to manual - ServiceFeatureTable QML Type | ArcGIS for Developers 

This basically would load the feature layer (fetch all metadata) but not fetch any actual data by default. Instead, in order to actually go out and fetch data, you'd need to call populateFromService with query parameters - ServiceFeatureTable QML Type | ArcGIS for Developers 

There is an example of this workflow here - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Features/ServiceFeatureTable_ManualCache at ... 

This would at least hopefully allow you initially load your map/app faster. You could build in an experience where the user needs to zoom in to a certain scale before you call populateFromService.

Other options I can think of are to lazy load like you are doing. Or if you are not performing editing you could consider using an ArcGISMapImageLayer instead of a FeatureLayer, as this is just sending images from the server as opposed to lots of feature JSON. Final option would be to see if generating local geodatabases by using the GeodatabaseSyncTask would work better. There would be an up front process of downloading the content, but once it was downloaded, it would likely load faster. If this is an option, you could maybe have some nightly process that generates local content and side loads onto devices so that once users use the app the next day, the most recent day's content is available.

0 Kudos