Dynamically update AGS Cache

Source: Internet
Author: User

Author: flyingis

The best way to increase the access speed of ArcGIS Server is cache, which stores all layer slices on the server and directly accesses the cached images when the client requests. There are two situations, first, all layers are cached. Second, some layers are cached. Some layers are still generated through the AGS service, that is, multi_layer, they may be updated frequently (update based on B/S browser, update on C/S client, or update via mobile wireless ), although this can solve the access speed problem to a certain extent, in some cases, the real-time requirements for maps are not very high, or some layers do not need to be edited frequently for the business, in this way, we can regularly update the cache so that the client can always access the cached map, which not only maximizes the client's browsing speed, but also meets certain real-time requirements of the system.

We know that both arctoolbox and arccatalog can manage the AGS cache, so we can use the geoprocessing tool to write scripts to generate and update the AGS cache. Note the following two points:

1. If the client needs to browse real-time data and has high real-time requirements, it is not recommended to use dynamic update cache. The multi_layer method is better.
2. If the cache size is very large and the data and symbols of the entire graph change frequently, we do not recommend using dynamic update cache. It is more suitable for dynamic update when the specified MAP range is updated.

Engineers who cache layers with large data volumes know that the larger the data volume, the larger the data size, and the larger the scale-in and scale-out layers, the longer the cache generation time will increase exponentially. Dynamic Update of the cache is used, you need to control the update time within a certain period of time. If the time is too long, it will be meaningless and even affect the application.

Python script writing is relatively simple:

# This script updates all tiles in An ArcGIS Server 9.2 map Cache

# Access the geoprocessing tools
Import arcgisscripting
Gp = arcgisscripting. Create ()

# Set up all of the variables for the update tool
SERVER_NAME = "myserver1"
Object_name = "precipitation"
Data_frame = "layers"
Layers = ""
Constraining_extent = ""
Scales = "32000000; 16000000; 8000000; 4000000; 2000000"
Update_mode = "recreate all tiles"
Thread_count = "2"
Antialiasing = "NONE"

# Run the update map server cache Tool
Try:
Print 'starting cache Update'
GP. updatemapservercache (SERVER_NAME, object_name, data_frame, layers, constraining_extent, scales, update_mode, thread_count, antialiasing)
Print 'finished cache Update'

# Get the error messages if the tool fails
Except t:
GP. addmessage (GP. getmessages (2 ))
Print GP. getmessages (2)

If you are not familiar with the Python script to control arctoolbox, we recommend that you check ArcGIS Desktop Help.

The updated script has been written, and the last is how to update regularly. Here, Windows Task Management is used. This is a very common function in windows, but it is rarely used in reality, "Start -- all programs -- accessories -- System Tools -- Task Plan" to create a new task. In addition, you can also use the command line to create a task, schtasks command:
Http://technet2.microsoft.com/windowsserver/en/library/1d284efa-9d11-46c2-a8ef-87b297c68d171033.mspx? MFR = true

To update the cache, you need to pay attention to the following three issues:

1. During the update process, the AGS service is restarted twice. Before the update, once the update is complete, the service is unavailable for the moment.
2. the update process consumes a certain amount of instances. If pooling is adopted, you should note that thread_count is smaller than Maximun Number of instances.
3. Update during low network hours at night.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.