How to reduce the number of service query requests?

318
1
02-17-2023 12:13 AM
Chapin
by
New Contributor III

Hello. I have developed a mapping application using ArcGIS Runtime SDK for Android. Now the program is used by 1000 people per day. Now, there is a very basic query operation: move the screen and query if there are any intersecting features at that screen location, which is a function to select features. However, from the database monitoring, these selection functions are executed too frequently, resulting in long session blocking. Is there a solution that can optimize this method of selecting features, reduce the number of requests for service queries, and reduce the pressure on the database? Some of the feature service that are queried are more read and less service, and some are more read and more write tables.

The following is a statement that executes a simple query with high frequency. It was requested 150W times in one day.

Chapin_0-1676621159157.png

Chapin_1-1676621183047.png

If anyone knows an optimization plan, I'd appreciate it. Thanks!

 

0 Kudos
1 Reply
Shubham_Sharma
Esri Contributor

Few things to consider:

To help optimize the number of service query requests, there are 3 caching options to choose from when querying from when querying from a service:

  • MANUAL_CACHE
  • ON_INTERACTION_CACHE
  • ON_INTERACTION_NO_CACHE

Check out the API ref: Link

We have a sample app demonstrating the caching functionality, you can use this to consider which caching mode best fits your app. 

A helpful tip is to set the maximum number of features to be included in the result as part of your QueryParameters, this will help stop users from zooming out and loading a ridiculous amount of features. 

QueryParameters.setMaxFeatures​(int maxFeatures)

 

0 Kudos