Looking at moving from 4.19 to 4.21+ and ran into a problem loading FeatureLayers from our backend ArcGIS Server REST MapServices. At 4.21 loading point layers with over a few million records becomes really slow on initial load. The time from initial request to draw went from a couple seconds or less to 30+ seconds.
When I watch the network traffic I can see that as of 4.21 there is now an initial fetch for the count of records with params like so:
`returnIdsOnly=true&returnCountOnly=true&spatialRel=esriSpatialRelIntersects&where=1%3D1`
This is returning the count of the records in the service layer and it consistently takes our server over 30 seconds to process.
The release notes for ArcGIS 4.21 say:
At version 4.19, we improved the performance of point FeatureLayers hosted on ArcGIS Online. Version 4.21 brings these changes to ArcGIS Enterprise point services.
It looks like this fetch of the count is part of a trick to try to speed up subsequent requests. As an aside we haven't noticed any improvement for any of our datasets/apps on subsequent fetches/draws either.
Some details:
Our point layer(s) come from an SDE Database Feature Class layer. The MapService is not cached. ESRI Canada technical support have confirmed they have been able to reproduce this problem with other large datasets of their own.
For our large datasets our use case is that these layers are configured to only draw at a very large scale where a couple thousand records draw at a time. Note that in the use case that ESRI demonstrates in their 4.19 release notes shows all the data drawn at once at full scale. I think their trick might provide advantages in that use case at the detriment of my own.
I would like this performance improvement approach to be opt-in in the API (Feature Idea) since ESRI won't consider it a bug.
I am also interested if users here know of tricks to speed up getting the recordCount of a large dataset via REST. For example I can get the recordCount via a direct SQL request to the database table in less than 2 seconds. Why does it take suddenly 30 seconds for ArcGIS Server? Is there some trick or optimization to cache this?