locked
SL application takes 15 seconds to inilialize RRS feed

  • Question

  • There is about 15 seconds of delay after xap file is loaded and before screen is displayed in 1 GHz / 1 GB Vindows XP client computers. It seems that SL plugin is jitting or doing something like this. How to remove this delay. In fast notebooks this delay is smaller.

    How to remove this delay ?

    Saturday, October 16, 2010 4:06 PM

All replies

  • I've never seen a 15 second delay.  Something is wrong.  Or you have a very large, very complex application.  The xap of course contains assemblies that are .net.  So they must be compiled locally.  But this is very fast.

    I just timed one.  It took about 5 seconds to download, jit, and display first page.  I refreshed the browser and it only took 1 to 2 seconds for the next run.

    Then I clicked a link that caused the wcf service call to iterate through 9 databases, retrieving a few records from each one, build a pagedcollectionview that is bound to a datagrid.  It took about 1-3 seconds.  And it took that amount of time or less on a refresh of the page (that caused the same 9 databases to be traversed).

    So 15 sounds like something is wrong.

    Saturday, October 16, 2010 4:58 PM
  • There could be many reasons why your app takes 15 seconds.  Can you step through your code to identify where it was taking this long?

    I do have an issue with SL initialization delay but it is unlikely the same cause as yours.  Anyway, in my application I use a particular custom font (read from stream).  When I instantiate the font (by creating a TextBlock) for the first time ever since rebooting the machine, it will take up to 15 seconds -- the entire time is spent in SL plugin code -- and even the mouse is frozen.  This problem only happens once, after a fresh reboot.  I imagine SL is doing some lazy initialization and it hits something nonlinear.  BTW this only applies to some fonts but not others.  I haven't found a solution to this problem and I haven't filed a bug.

    Sunday, October 17, 2010 2:09 AM
  • FWIW, I tried the web page and didn't observe any 15 second delays.  The biggest delay was when the progress bar showed progress and that was usually around 3-5 seconds.

    Sunday, October 17, 2010 7:53 AM
  • Testsite is at   http://tellimine.topparts.ee

    On initial load, if application is not in browser cache, it takes 22 seconds to load (on 3 MBit download speed) .

    First-time user will not wait 22 seconds for application start and navigates to other site. How to remove this delay ?

    Please clear browser cache before each test.

    Andrus.

    Wednesday, October 20, 2010 2:45 PM
  • Wow.  How big is that xap?

    Wednesday, October 20, 2010 11:20 PM
  • xap file is about 2 MB. Server upload speed is 1 Mbit, maybe this is the reason.

    If so, Is it best to create plain login.htm page which asks for user name and password and passes them to silverlight app standard index.htm file file which is launched if login button is pressed in this page?

    In this case User/password are sent as POST request keys. How to retrieve them from SL application or is there better solution ?

    Andrus.

    Thursday, October 21, 2010 5:53 AM
  • Assuming you mean from Server to Client, 1MB (is it bit or byte) seems slow to me.  But have a separate login page only delays the long download process.

    I have a 1.5 MB xap and it is loaded in about 3 seconds.  My home networks speed is somewhere between 10Mb to 30Mb.  Not sure of the server restrictions.

    You could also make a Separate login of SL if you wanted. 

    But in either case you should be careful of passing user and password in plain text.

    Thursday, October 21, 2010 6:01 AM
  • Let me do the math...   8bits per byte, call it 10.  So a 2MB file is about 20Mb.  Divided by 1Mb transfer speed = 20 seconds.

    15 seconds sounds about right.

    Thursday, October 21, 2010 6:10 AM
  • Maybe you should make it an OOB app.  So you could get your users to Install it on desktop.  Then the download only happens when there is a new version.

    Thursday, October 21, 2010 6:11 AM
  • Once loaded, pressing F5 button in browser retrieves xap from browser cache. So Initial load time is same. OOB does not allow to use browser commands.  OOB requires additional confirmation from user. OOB does not allow to use broweser history (back and forward buttons).

    So using OOB does not resolve the initial load speed issue.

    There may be 3 solutions for this:

    1. Use traditional html pages, stop using SL.

    2. Create separate login page as html. No idea how to pass user/pass from this to XAP file

    3. Create small xap file which reads user/password and invokes other xap file after that. No idea how to pass user/pass to this new xap.

    Which is best solution?

    Andrus.

    Thursday, October 21, 2010 7:20 AM
  • Once loaded, pressing F5 button in browser retrieves xap from browser cache. So Initial load time is same. OOB does not allow to use browser commands.  OOB requires additional confirmation from user. OOB does not allow to use broweser history (back and forward buttons).

    OOB would save the reload the NEXT time they try to use it after reloading the browser.  Whether the browser has it cached for the NEXT time depends on the browser and user settings.

    I'm not sure what browser commands that you want to use, nor why.  So I can't make suggestions there.  SL has its own navigation framework which can be used OOB.

    I THINK there is a video, maybe by Tim Heuer and maybe on this web site, showing an easy way to make your own back and forward buttons that just do SL navigation, so that part would be pretty easy without browser.

    OOB does require a one-time approval by the user, but it would save all the 20 second reload startup time of In browser.


    So using OOB does not resolve the initial load speed issue.

    But DOES resolve the subsequent "initial load" issues.


    There may be 3 solutions for this:

    1. Use traditional html pages, stop using SL.

    Yep, could definitely do that.  Personally I would hate to because of having to either use javascript which I don't particularly like or Asp.Net stuff which I don't like either.

    But a definite possiblity.  Personally, I would do this as a last resort only, but it is doable.  Although you may find OTHER response time issues later.  That is why we are in the process of switching from an Asp.Net application to SL because SL is better structured and avoids performance problems we were having.  And SL make the UX better (or can).


    2. Create separate login page as html. No idea how to pass user/pass from this to XAP file

    This is an issue we haven't gotten to yet.  I'm sure there are solutions, but I wish there were a best practice on this with a video here.  And I think there are some basic videos on how to do such a thing, but not "real world" enough as I recollect.


    3. Create small xap file which reads user/password and invokes other xap file after that. No idea how to pass user/pass to this new xap.

    Another way to potentially save speed on the subsequent loads of the xap is to use zipped dlls.  There is an option on the SL properties page to "reduce xap size".  Basically it takes all the dlls that your xap uses and pulls them out into separate zip files.  These files can be cached and then only the xap needs downloading later.  You might want to check out this option.


    Which is best solution?

    Andrus.

    Too soon for me to say which is best, but I would try a couple of the SL options before moving back to non-SL.

    Thursday, October 21, 2010 8:05 AM
  • Whether the browser has it cached for the NEXT time depends on the browser and user settings.

    If I close and re-open browser, xap file is not re-loaded. returned xap does not have any cache settings specified. If debugging this in Fiddler, fiddler shows comment that typical browsers hold this in cache for 4 hours. My main goal is to reduce login screen load speed so OOB is not solution.

    And I think there are some basic videos on how to do such a thing

    Where do find links for this ? Probably it is possible to use javascript, xmlhttp, server sessions or cookies for this. I'm interested for best solution.

    These files can be cached and then only the xap needs downloading later

    I tried this for SL standard dlls. In this case it takes 12 seconds to load xap file and after that browser freezes for 10 seconds. No load animation, nothing. It looks like all dlls referenced by application are always loaded before App() constructor call. So this does not reduce initial download speed but provides even more frustrating user experience.

    I think that if 2 MB SL XAP file is splitted into multiple SL projects and created separate SL dlls, SL runtime loads all them after xap load without showing any animation. So it looks that this does not fix anything. It seems that SL does not have dynamic assembly loading support.

    Andrus.

    Andrus.

    Thursday, October 21, 2010 8:46 AM
  • FWIW, browser settings come into play.  I tell my browser not to cache anything because in my testing, I don't want to see anything old.  So caching depends on browser settings.

    And I think there are some basic videos on how to do such a thing

    Where do find links for this ? Probably it is possible to use javascript, xmlhttp, server sessions or cookies for this. I'm interested for best solution.

    Uhhh... Look in the Videos tab here?

    It looks like all dlls referenced by application are always loaded before App() constructor call. So this does not reduce initial download speed but provides even more frustrating user experience.

    Uhhh...  App can never run until libraries that it uses are loaded.  I don't see that no response happening in my environment.  Probably that host speed is having an effect again.

    I think that if 2 MB SL XAP file is splitted into multiple SL projects and created separate SL dlls, SL runtime loads all them after xap load without showing any animation. So it looks that this does not fix anything. It seems that SL does not have dynamic assembly loading support.

    No, you can have separate xaps in separate virtual directories and only 1 at a time get loaded, IF you do it that way.

    There is dynamic XAP loading. 

    Google is your friend.


    Thursday, October 21, 2010 9:03 AM