Select to view content in your preferred language

Question on caching in Silverlight..

1016
9
03-16-2011 10:19 AM
JoshV
by
Regular Contributor
I have a Silverlight App that just has a DynamicMapServiceLayer, a TiledMapServiceLayer, and a FeatureLayer.  The DynamicMapService just has two layers but one layer has about 30,000 features.  I have set TimeEnabled on the two layers in the DynamicMapService.  Now when I run the TimeSlider Tool in the Silverlight App, sometimes it will flash the features through the first iteration of the TimeSlider and then appears to get everything showing on the second iteration (I assume because its caching everything on first iteration?).  Then there are times when I run this Web App and it will go through multiple iterations of the TimeSlider and always just flashes the features for a second and dissapears for multiple seconds and never seems to fully show everything. 

Can someone explain what is going on here and how I might be able to get this working everytime I open the App?

Thank you very much.

Regards,
0 Kudos
9 Replies
JoshV
by
Regular Contributor
Does anyone have any detailed pointers they can give me on caching with Silverlight?  I'd love to hear a detailed analysis on caching with the Timeline tool but if not then just caching with Silverlight and how exactly that works might be beneficial to me.

Thank you very much.
0 Kudos
ChristopherHill
Deactivated User
Which layer are you having an issure with? FeatureLayer or DynamicLayer? Can turn off the visibility of the other layers and look at how a single layer is performing. What is it that you want to cache graphics from feature layer or tiles from dynamic service?
0 Kudos
JoshV
by
Regular Contributor
Which layer are you having an issure with? FeatureLayer or DynamicLayer? Can turn off the visibility of the other layers and look at how a single layer is performing. What is it that you want to cache graphics from feature layer or tiles from dynamic service?


Hi Chris-

I'm having an issue with the DynamicLayer.  The DynamicLayer has only two layers and one of the layers has about 30,000 features and each layer is Time enabled.  Now if I create a Silverlight App that just shows that DynamicService and I run the TimeSlider it usually runs perfect.  When I add a FeatureLayer to this Silverlight app and run the TimeSlider almost always the DynamicService flashes on and off (as if its caching?) but the FeatureLayer always seems fine.  Funny thing is if I run the TimeSlider in a silverlight App with just that DynamicService One Time, pause it after the first run, open a new browser window and then run the Silverlight App that has the DynamicService And the FeatureLayer then it will usually run perfectly.  Almost as if it uses the cache from the simplified Silverlight app.

Besides the above issue I can't also explain this: 

If at any time my machine locks out (you know after 10 minutes most admin settings force the machine to lock) and I log back in my App seems to lose its cache and has to run another iteration on the TimeSlider to recreate.
0 Kudos
JenniferNery
Esri Regular Contributor
In your application, can you try to replace the URL with services from a sample server and does it reproduce the same behavior that you described? Can you share your code on how you defined the FeatureLayer and ArcGISDynamicMapServiceLayer? Please provide us with steps that will allow us to replicate this.  Thank you.
0 Kudos
JoshV
by
Regular Contributor
In your application, can you try to replace the URL with services from a sample server and does it reproduce the same behavior that you described? Can you share your code on how you defined the FeatureLayer and ArcGISDynamicMapServiceLayer? Please provide us with steps that will allow us to replicate this.  Thank you.


Hi Jennifer-  attached is my XAML and my Codebehind.  I tried replacing my DynamicServices with services from ESRI and it seemed to work fine.  As mentioned above the strange thing is if I just use my DynamicMapService in the attached Silverlight App then it seems to work fine.  If I add in my FeatureLayers and run the TimeSlider the FeatureLayers always seem to run correctly and most of the time the DynamicService will not run correctly (flashes like its building the cache but after multiple iterations it still does the same thing, very rarely does it cache right the first time.  but if I run the simplified Silverlight App (only has the dynamic layer) for one iteration and then run the Silverlight App that has my dynamiclayer and the featurelayers it usually runs well.
0 Kudos
ChristopherHill
Deactivated User
The caching is being done by the web browser, what i think might be happening is that the time slider is playing to fast for the browser to keep up with caching the tiles. try setting your play speed to something slower and see if you are still getting the caching issue after the timeslider goes through its first iteration.

you can also see if the browser is caching or preforming new reqeust for tiles by using Fiddler. This tool allows you to see your outgoing web request and the response that comes back. when it request something that is cached you should see 304 code which means "not modifed" and it will pull the tile from the browser cache instead of sending a new request for the tile.
0 Kudos
JoshV
by
Regular Contributor
Hi Chris and Jennifer-

I was using FeatureLayer_Initialzied on both of the FeatureLayers and using ArcGISDynamicMapServiceLayer_Initialized on the DynamicMapService at the same time.  If I remove the FeatureLayer_Initialzed from the two FeatureLayers it appears to work right.  Is this ok to do?
0 Kudos
JenniferNery
Esri Regular Contributor
I just looked at your code-behind to see what your FeatureLayer_Initialized event handler does.

The issue is that you are setting your time slider intervals three times:
1 when your ArcGISDynamicMapServiceLayer is initialized, and
2 when your FeatureLayers are initialized.

The odd behavior that you were experiencing is because the time slider takes the setting of the last layer that initialized and the order of when these layers are initialized is random.

Since your TimeSlider Start and End times are set from your WellsLayer (ArcGISDynamicMapServiceLayer), you need the intervals of this layer and not the FeatureLayers'.
0 Kudos
JoshV
by
Regular Contributor
I just looked at your code-behind to see what your FeatureLayer_Initialized event handler does.

The issue is that you are setting your time slider intervals three times:
1 when your ArcGISDynamicMapServiceLayer is initialized, and
2 when your FeatureLayers are initialized.

The odd behavior that you were experiencing is because the time slider takes the setting of the last layer that initialized and the order of when these layers are initialized is random.

Since your TimeSlider Start and End times are set from your WellsLayer (ArcGISDynamicMapServiceLayer), you need the intervals of this layer and not the FeatureLayers'.


Hi Jennifer-  So in short, you are saying I can just remove the FeatureLayer_Initialized event handlers since my TimeSlider is just using the ArcGISDynamicMapServiceLayer_Initialized handler?
0 Kudos