“I published my map service but I don’t see it in my Services Directory.”
We’ve received similar questions on the forums from users asking why their
services are not showing up in the Services Directory. The reason in most cases
is that they didn’t
clear the REST API Cache. This blog post talks about how and when you
might want to clear this cache. It also gives a brief background about the REST
API Cache, its benefits and side-effects.
UPDATE: As duly noted by some of you in the comments section, there are a couple more reasons for your service not showing up in the Services Directory:
- Non-pooled services: The REST API works with pooled services only. So if you have published your services as non-pooled services they won’t show up in your Services Directory.
- Web access disabled: When you publish your services, web access is enabled by default. However, you have the option of disabling it in both ArcCatalog and Manager. Disabling web access will make your service unavailable for access through both SOAP and REST.
The REST API caches information about folders and services to boost
performance. The REST application is implemented such that the first time a
service (or a folder) is accessed it fetches the information for that service
from ArcGIS Server and caches it. This means that subsequent requests to the
service will be served from the internal cache, saving another trip to the
server. This reduces resource consumption and improves performance.
Here’s a
Python script that accesses all services and folders within a given
REST application instance. Here is a table of the times it took to run through
the entire catalog on various servers deployed internally within ESRI.
| Server (not their actual names) | 1st run time taken (in secs) | 2nd run time taken (in secs) |
|---|---|---|
| server1 | 16.125 | 0.531 |
| server2 | 13.344 | 0.578 |
| server3 | 12.625 | 0.547 |
| server4 | 59.296 | 0.500 |
| server5 | 70.968 | 0.531 |
| server6 | 29.640 | 0.328 |
While your actual numbers might vary, you can see there is a substantial
difference in the time it takes to run through the catalog the first time (when
the information is not cached) and the second time (when the information is
cached).
Remember that the first access will take a performance hit as indicated by the
numbers above. This hit comes not only in accessing the service information
from the server, but also in initializing the servlets and JSPs (for Java), and
the HTTP handlers and modules (for .NET). If you do not want a user to take
this performance hit, you can run this script and let your users benefit from
the cache that gets populated by running the script.
Caching information in this manner also has a side-effect in that if you add,
remove or update services on the server, those changes might not get picked up
by the REST API. This is where the REST Admin plays an important role.
Administrators can use the REST Admin to clear the REST API cache either
manually with the click of a button or configure it such that the cache
automatically gets cleared periodically. The REST API includes detailed
documentation for both the
REST Admin as well as for the various
configuration options available to you.
Again, you can download the full script
here. (It uses the simplejson library which can be downloaded from
here.)
Contributed by Keyur Shah of the ArcGIS Server development team
3 Responses to The REST API cache
Leave a Reply
You must be logged in to post a comment.
Read through the thread above as well. I had a problem with my map services not showing up in the REST Services Directory and we tracked it down to how the map service is published. If you publish a map service as non-pooled it will not show up in the REST Services Directory; the map service has to be published as a pooled service.
Hope that helps.
Bill Dickinson
Principal GIS Engineer
ESS
Linthicum MD
Just noticed my last post did not have the URL in it, so here it is:
http://forums.esri.com/Thread.asp?c=158&f=2399&t=260919&mc=8
Can you walk me through what I need to do to get the python script to work? I have downloaded the simplejson-2.0.7.win32-py2.5.exe file and installed it and then tried to run the python script. It returned the following error:
Failed to execute (RESTCache).
End Time: Wed Jan 14 14:42:38 2009 (Elapsed Time: 1.00 seconds)
Any ideas?
Thanks
Cameron