2

I have a Silverlight application that loads extremely slow from IIS. When I debug it takes about 5 seconds to load, where as from the server it takes over a minute. The size of the xap is only 8 MB, which does not seem particularly large to me, and although I have heard others talk about reducing the amount of media in the xap, my app only contains three low res icons, which should not have much impact. I have tested this from internet connections from ~10Mbps to ~24Mbps and there does not seem to be a whole lot of difference. Due to frequent changes, I have disabled application caching so that updates go through, but allowing caching still would not help the 1-2 minute load times for first time users (not exactly a great first impression).

Needless to say, this has left me with a few questions:

  • Does this sound like a hardware/IIS issue or something that I have control over from the application side of things.
  • Is an 8MB xap file larger than a typical xap?
  • What could cause the difference between the debug load times and the deployed load times?
  • I cannot imagine this is the case, but is a 1 minute start up time to be expected?
Morgan Herlocker
  • 1,498
  • 4
  • 24
  • 42
  • 8MB is bigger than the Silverlight download itself. ;) Is this a really big, complex application? If not, I'd say the XAP is bigger than it should be. And, I know it's kind of a 'duh' thing, but you are deploying a Release build and not a Debug build, right? – kitti Feb 15 '12 at 21:12
  • @Morgan, did you ever find a solution to this? (debug vs. deploy load times) – Johnny Oct 05 '12 at 23:20

4 Answers4

2

Are you following the best practices?

Mike Post
  • 6,355
  • 3
  • 38
  • 48
1

8 MB is pretty big. I guess it's because you have a lot of fonts or videos or images that are packaged inside that file. They are the first thing that you need to minimize if you need to make it performant. There are many other reasons why an application can be small, but these elements specifically can be abused to make anyone cry !

  • Nope. As I mentioned, the only media in the entire app is 3 icon image files (around 1 KB each). If 8MB is big, what size is a typical xap? – Morgan Herlocker Feb 15 '12 at 22:55
  • 3 to 5 MB if it has a lot of stuff... remember, it is not required for you to SEE the images for them to be there. The resources might just not be visible. Also the delay can also be after the load... maybe the app is making a web service call to get a huge amount of data that it thinks it might need (which is not a good practice! Load only when you need to !) –  Feb 15 '12 at 23:29
1

A file size of 8 MB is pretty large for a xap file. I've read where some people can keep their xaps down to 250k, even for graphics intensive apps... but you have to do a lot of things to keep the size down like dynamically loading the images or video from outside the xap somehow. I don't know how to do it, but that is not your issue anyway.

I had a couple of apps that have pretty large xap file sizes until I learned that for every reference to a dll that you have it adds size to the xap because it has to include the dll in the xap when it compiles it. I use to just add dll references to projects that I was testing, or maybe because I thought I might need it... and then just left the unused dll in there... but then the size of the xap would just keep growing. This was when I was back when I was first learning silverlight...

I found that if I just cleaned out the unused references it shrunk the xap sizes from 8 MB down to 3 and a half (which is still kind of heavy, but not as bad as 8). I also went through and looked for dll references that I was only using in a few places or maybe one place and tried to figure out if I could just implement that functionality some way other than having to use another reference to the project. I'm telling you, references cause xaps to get heavy quick!

You may not have extra, unneeded references in your project... but it is a good place to look just to make sure.

Barry Franklin
  • 1,781
  • 1
  • 27
  • 45
1
  1. It does not sound like a hardware/IIS issue. Serving 8Mb is a cinch.
  2. Is an 8MB xap file larger than a typical xap? It sounds pretty big to me. Rename the xap file with a zip extension and see what is inside.
  3. What could cause the difference between the debug load times and the deployed load times? It is virtually all network calls. Run fiddler and observe them. Fiddler also can simulate different modem speeds.
Chui Tey
  • 5,436
  • 2
  • 35
  • 44