I understand that ArcGIS JS 4.19 was changed to load *all* points from ArcGIS Online FeatureLayers into memory and that in 4.20 that was extended to also include Enterprise FeatureLayers.
We have an Enterprise point FeatureLayer with ~350k points and we'd very much like to prevent that from occurring as it hammers our performance.
Will there be any options to prevent this behavior? Maybe an option to choose whether it should try to load all points or not?
Additionally, we have an issue in 4.21 and/or 4.22 where changing the definitionExpression of a layer does not remove points/clusters from the map when the definitionExpression is more restrictive but I'm not sure if that's a by-product of this issue or not.
Solved! Go to Solution.
Hi there,
So the snapshot mode (we load all features on layer load) is enabled when one of the following conditions are met, otherwise layers will fetch its data as needed:
Snapshot should be very performant after the initial load. However, if you are making server side calls via refreshInterval or refresh() method, this can slow down the performance as the app has to download the entire data.
Have you considered using client-side filters like FeatureFilter or FeatureEffect on the FeatureLayerView? If you are querying your data also have you considered using client side queries via FeatureLayerView.queryFeatures()? Setting those properties and calling the those methods on the LayerView will take place on the client-side without having to fetch data from the server side.
I created a very simple test app where the layer is loaded in the snapshot mode. I have aded a few buttons where you can set the layer.definitionExpression versus layerView.filter. If you have the network tab open, you'll notice that setting layerView.filter does not generate network requests.
In any case, you can opt of out your layer loading in a snapshot mode by setting featurelayer-snapshot-enabled flag to 0. You can test this flag in the test app I provided by uncommenting the script tag added towards to beginning of the app: https://codepen.io/U_B_U/pen/dyVLKaG?editors=1000
I cannot reproduce the definitionExpression issue you are describing.
Hi there,
So the snapshot mode (we load all features on layer load) is enabled when one of the following conditions are met, otherwise layers will fetch its data as needed:
Snapshot should be very performant after the initial load. However, if you are making server side calls via refreshInterval or refresh() method, this can slow down the performance as the app has to download the entire data.
Have you considered using client-side filters like FeatureFilter or FeatureEffect on the FeatureLayerView? If you are querying your data also have you considered using client side queries via FeatureLayerView.queryFeatures()? Setting those properties and calling the those methods on the LayerView will take place on the client-side without having to fetch data from the server side.
I created a very simple test app where the layer is loaded in the snapshot mode. I have aded a few buttons where you can set the layer.definitionExpression versus layerView.filter. If you have the network tab open, you'll notice that setting layerView.filter does not generate network requests.
In any case, you can opt of out your layer loading in a snapshot mode by setting featurelayer-snapshot-enabled flag to 0. You can test this flag in the test app I provided by uncommenting the script tag added towards to beginning of the app: https://codepen.io/U_B_U/pen/dyVLKaG?editors=1000
I cannot reproduce the definitionExpression issue you are describing.
@UndralBatsukh Thank you for this! Opting out fixed the issue! Is this something that will be maintained long-term?
We must be triggering the second condition. We have a default extent of the whole US view and then we detect and have > 350k features. With that many features, client side filtering doesn't work well for us.