Proposed Answer Speed optimization?

  • Wednesday, November 21, 2012 1:06 PM
     
     

    Hello,

    I want to have more speed with my LS solution - there are the following problems:

    • startup loading time
    • loading of complex screen (uses some entities with tab controls etc.)

    are there some hints and suggestion to become better response speed for my solution?

    robert

All Replies

  • Wednesday, November 21, 2012 6:53 PM
     
     

    Hi madrianr,

    You can try this - Dynamic compression (gzip, deflate) 

    and do not use many properties calculated.

    for me the speed increased significantly :)


    • Edited by Yann DuranModerator Wednesday, November 28, 2012 11:58 AM Changed the text for the link
    •  
  • Wednesday, November 21, 2012 6:56 PM
     
     

    I use only a few calculated properties and my app is a desktop app...

    robert

  • Wednesday, November 21, 2012 9:06 PM
     
     Proposed Answer

    Hey Madrianr,

    About the start-time: just wondering but are you running the app from visual studio?  In case you are I want to ask you to test your app in "Release" mode instead of in "Debug" mode, or actually deploying it to a local IIS or something and testing the speed from there.

    Sometimes LightSwitch seems slow if you only see the apps with the debugger attached ;-)

    About the complex screens: LightSwitch at the moment is indeed more CRUD-oriented which can sometimes slow things down when you have a lot of things happening on a screen.  A couple of speed-improving hints (depending on your scenario) in order of increasing difficulty:

    * consider removing all calculated properties all-together.  I like them, but they have some downsides, one of which being performance.  Instead, change it to a normal value property and write (duplicate, I know) code in the _Inserting and _Updating events on the server to calculate & store the value.

    * consider adding a WCF RIA service that combines different entities on the server (I think Michael Washington has a post on this exact subject)

    * similarly, consider adding your own ApplicationData database as a data-source, this way you can add a View on a couple of tables (and import that as an "entity" in the app), and have the heavy calculations done on the server.

    * similarly to storing the computed values instead of having them computed when you need them, you can create a denormalized table and update that.  This is very situational, I have something similarly set up in a particular app,  only because they have quite a bit of BI set up to it was easy to hook into their data warehouse.

    * if all else fails, ask the end-user if you can reduce the amount of information on the slow screens.  Instead of tabs, create buttons (screen commands) that open up a new screen with the contents of that tab.  Again, situational but if all else fails, why not?

    Keep rocking LS!!

    Jan


    It's your story - time to switch on the innovation. || About me || LightSwitch blog

  • Wednesday, November 21, 2012 9:17 PM
     
     

    One addendum:

    the reason why LightSwitch seems so slow when ran from VS compared to when it is actually deployed has to do with the LocalDB technology on an attached database file is a lot slower than an actualy SQL2008 or SQLAzure instance ;-)


    It's your story - time to switch on the innovation. || About me || LightSwitch blog

  • Thursday, November 22, 2012 8:28 AM
     
     

    the released version is a little bit faster than the debug version
    i also use computed columns on SQLServer to avoid calculated properties (I have only twice and these are no problems in speed)

    • If I start the app with vslshost.exe it takes about 10sec and the sllauncher.exe comsumes 130MB RAM for a app with a xap file with 9MB - is this normal?
    • also I'm not able to have a "animation" like 15% are loading instead of the normal "Loading..." text - or is there a way to to this?

    another reason with performance problems in my desktop IS app is the feeling with the app - during working with it some reaction from the app is slow - if I change a tab i have to wait 1-2sec to display data in a grid - there is no interaction with the DB but I have to wait and there is no hourglass
    my costumers are working with a lot of apps from me which are based on VB6 and WinForms and these are a lot faster than the LS app...

    robert

    • Edited by Mad Rian Thursday, November 22, 2012 8:35 AM
    •  
  • Tuesday, November 27, 2012 6:56 PM
     
     

    the released version is a little bit faster than the debug version
    i also use computed columns on SQLServer to avoid calculated properties (I have only twice and these are no problems in speed)

    • If I start the app with vslshost.exe it takes about 10sec and the sllauncher.exe comsumes 130MB RAM for a app with a xap file with 9MB - is this normal?
    • also I'm not able to have a "animation" like 15% are loading instead of the normal "Loading..." text - or is there a way to to this?

    another reason with performance problems in my desktop IS app is the feeling with the app - during working with it some reaction from the app is slow - if I change a tab i have to wait 1-2sec to display data in a grid - there is no interaction with the DB but I have to wait and there is no hourglass
    my costumers are working with a lot of apps from me which are based on VB6 and WinForms and these are a lot faster than the LS app...

    robert

    Are you using VS 2012?

    Is your database server on the same local network as your IIS server?


    Garth Henderson - Vanguard Business Technology

  • Tuesday, November 27, 2012 7:05 PM
     
     
    I'm using VS 2012 and LS as a desktop app and the db server is on the same network
  • Tuesday, November 27, 2012 8:12 PM
     
     
    I'm using VS 2012 and LS as a desktop app and the db server is on the same network

    Do your users have a fast (enough) Internet connection?

    What is your environment for IIS && DB?   Is it a shared hosting?  Azure? 

    Have you tried deploying and benchmarking your app in a local test environment (both IIS and DB on local lan)?   Is your app still slow to load?

    NOTE:  Our LOB Desktop apps takes about 5 seconds to load (from a hosted provider) to get to the Login Screen.   All data retrievals are designed to be optimal.   Client side data processing is (understandably) slow - but server side processing is pretty fast.

    Logical consideration:  Every LS app is going to have the same response times based on "best practices" development.

    It seems like a good idea to use a technology similar to: Web Platform Docs

    for our LS community to create a consensus on best practices.

    When we look at the big picture, do LS apps perform as well as or better than any other web app LOB environments? If the answer is no, we need to figure out why LS is slower.

    Of course, we always need to figure out ways to speed up LS and associated .NET technology.  

    Bottom line:  We need LS to perform as well as any other web app development environment.


    Garth Henderson - Vanguard Business Technology


  • Wednesday, November 28, 2012 5:04 PM
     
     

    I completely agree that we need to determine why our LS apps are slower than other web apps. In particular, which part of an LS app is the bottleneck.

    Does anyone know what tools are available to evaluate our LS apps and provide metrics such as load/access time and CPU/Memory utilization for the various LS components and/or tiers?

  • Wednesday, November 28, 2012 5:09 PM
     
     

    It is horrible how slow a lightswitch app is if it is not running on a PC with quad core cpu and > 4GB RAM...

    our LS App need's > 30 sec to start

    See: Loading time... (> 30sec)

    what I can see is a CPU utilization up to 100% on every task which I start in my app (open a screen, switch tab...)


  • Wednesday, November 28, 2012 5:47 PM
     
     

    It is horrible how slow a lightswitch app is if it is not running on a PC with quad core cpu and > 4GB RAM...

    our LS App need's > 30 sec to start
    http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/7374eb98-9cb4-4a31-ac6d-06af694dee83

    what I can see is a CPU utilization up to 100% on every task which I start in my app (open a screen, switch tab...)

    Something isn't right.   We run with users on client boxes with 2GB of RAM with XP, Vista, Win 7, and Win 8.  The client app takes up around 200K of memory - and we have some tough queries and updates.

    Please let me know what the answers are to the two questions I had asked yesterday:

    • What is your environment for IIS && DB?   Is it a shared hosting?  Azure? 
    • Have you tried deploying and benchmarking your app in a local test environment (both IIS and DB on local lan)?   Is your app still slow to load?


    Garth Henderson - Vanguard Business Technology

  • Wednesday, November 28, 2012 6:20 PM
     
     

    we need no IIS because it is a desktop LS app

    • DB is a SQLServer 2008 R2 8 Cores 12G  RAM

    on my local machine it is faster because this is a i7 8GB RAM with SSD's

    but also consumes a lot of RAM and CPU (vslshost.exe and sllauncher.exe)

  • Thursday, November 29, 2012 6:31 AM
     
     

    The performance problem is serious, one of my customer today is pissed off with the lightswitch based ERP solution which we developed for him. By pissed off, I mean my customer can't carry on to use my lightswitch app. 

    Based on my experience, the bottleneck is more in client side than server side. Loading a complex screen is terribly slow, I believe it's because the runtime ContentItem takes a lot of memory and time to initialize.

    I'd really like LightSwitch Team take it  seriously, I'm lossing my customers.

  • Thursday, November 29, 2012 6:44 AM
     
     

    we are in a similar situation - the solution is finished and it looks good and functional but only in a acceptable performance on my development machine (acceptable but not fast and this on a quad core cpu)

    What does MS and the Lightswitch team say to that situation?

    MS should investigate in that problem with priority instead of consuming all power in extending LS with HTML5 functionality (it is also important but first it should be possible to build apps which are acceptable in performance )

  • Thursday, November 29, 2012 12:45 PM
     
     

    Sorry, I can't help you with the local "fat client" Desktop.   I only use the OOB Desktop client.

    Are all three of you that have the speed problems deploying with the local Desktop client?

     

    Garth Henderson - Vanguard Business Technology

  • Thursday, November 29, 2012 12:53 PM
     
     

    I believe that instead of simply saying "it's slow", if we can provide clear precise metrics, either the LS team or the community at large can more easily provide a solution.

    ryan lin, you say that the bottleneck is in the Client side. I agree but my belief is just based on casual observation. I don't know how to properly measure the performance. You say that "ContentItem takes a lot of memory and time to initialize". How much memory? How much time? How are you measuring this?

    What tools are available to provide an in-depth analysis of our Lightswitch apps so that we can find out exactly what on the Client side is causing the app to respond so slowly?

    My company has committed to Lightswitch for this project because it seems to be the right technology for our application. But the performance is so bad that it's embarrassing. I can probably get them to spend a decent amount of money if I can guarantee that it will help me fix the problem.

    Does any one have any experience with Telerik Test Studio? Would something like that properly analyze a Lightswitch app? What kind of granularity does it provide? It's hard to justify $2500 when VS Pro only cost $500. Does anyone have any experience with any other performance testing tools?

  • Thursday, November 29, 2012 12:58 PM
     
     

    I don't understand the difference between "fat client" Desktop and OOB Desktop. But I'm actually working with an In-Browser web app.

    Performance is marginally better when deployed to Azure versus debugging on Localhost. But it is still unacceptable.

  • Thursday, November 29, 2012 2:51 PM
     
     

    I would say the speed of my app is less than it should be.

    2-tier desktop app.  Takes a good 25 seconds to start up.  Opening a complex screen takes up to 10 seconds before the controls are usable.

    I try to keep the data down to a minimum.  Information is shown tabbed where possible, modal window pickers are used instead of drop-down boxes, with auto execute turned off.

    From looking at task manager/resource monitor it would seem the actual data coming from the server is the first thing that happens, and it happens fairly quickly.  The bottleneck is the client trying to display the info.  The data would seem to be transferred within a second, whereas the processor shoots up to 100% as it tries to display the interface elements.

    I do have some "busy" screens with a lot of items, but this should be a fairly trivial task for the computer to lay out.


    Free Visual Studio LightSwitch extensions: Elyl's Extensions

  • Thursday, November 29, 2012 5:43 PM
     
     

    Hello

    as i can see there are a lot of people having the same problem with the OOB App (I think it is the same with the browser app)

    • vslshost.exe and sllauncher.exe consumes a lot of RAM (250MB) and CPU (up to 100%)
    • response from the app is very slow (Grid Scrolling - consumes also a lot of RAM)
    • loading time is > 30sec
    • sometimes at first start Error "HttpRequestTimedOutWithoutDetail

    please LS Team - i think there is urgent action required...

  • Thursday, November 29, 2012 6:30 PM
     
     

    I suggest that we setup a web conference call with an LS engineer using Lync so that we can switch between our apps during the discussion and get into specifics.

    Our apps in an OOB load up in 5 seconds to get to the login screen.   A screen search that retrives 57 pages of records takes 5 seconds.   A screen search that returns 1 page of info takes less than 2 seconds.

    Most of the client machines have less than 2GB of ram.

    I'm in Hawaii and our hosted Hyper-V VM is in St. Louis (Central Time Zone) - thousands of miles away.

    Some of our screens are very complex in terms of LOB/ERP processing.  

    Our Search screens are very complex with lots of ACB lookups.   The database is very complex in terms of relationships.

    Bottom line:  LS performs great for a web based RAD app environment. 

    It is just good business sense for MS to spend a few minutes with you to explain what the performance issues are.

    Each one of you can create a simple LS app with one table and one Grid Screen.  Deploy the Simple App.  You should all get the same performance level.  

    Your bigger apps will take a little longer to load - but not much longer. 

    If a specific Screen doesn't respond well - figure out why.

    Work together.   Help each other out.  

         


    Garth Henderson - Vanguard Business Technology

  • Thursday, November 29, 2012 6:57 PM
     
     

    Hello,

    our App consists only about 26 Tables (most of them are Lookup tables) and 31 views - there are only one "complex" screen with 4 tabs (i think it is a simple screen - see attached picture)

  • Thursday, November 29, 2012 7:43 PM
     
     

    Hiya Robert,

    Email me if you want to screenshare:  garthh@vanguardok.com


    Garth Henderson - Vanguard Business Technology

  • Thursday, November 29, 2012 8:19 PM
     
     

    Just a thought, you are taking advantage of hardware acceleration with Silverlight? If you are not it is poor with grids and can make a LightSwitch app barely usable.


    Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.

  • Thursday, November 29, 2012 8:27 PM
     
     

    what is hardware acceleration with Silverlight and how to activate it?

    incidentally: after working a few minutes with my LS app it consumes > 600MB of RAM - ist horrable...

  • Friday, November 30, 2012 3:32 AM
    Moderator
     
     

    Hallo Robert,

    I'm afraid I wouldn't call that screen "simple". You have tabs that are nested three levels deep for a start. Multiple ACB's, & multiple grids. And that's only on the tabs that we can see in the image. I imagine tyhere's even more of the same on the tabs we can't see.

    Not that I don't want to see LightSwitch able to handle screens like this, but it's definitely more complex than would have originally been imagined when LightSwitch was first created.

    Personally, I think the move to OData has been causing performance problems. And I'm pretty sure that the LS team were "forced" to release when VS 2012 was deemed "ready", whether they had finished the optimisations/improvements that they would have liked to have done, or not.

    By all means, let's see if we can get the team involved & maybe help them understand where performance needs to be improved, but I just want you to realise that what you're doing here is really quite complex from a LightSwitch point of view. LightSwitch is not optimised for "speed", it's optimised for "simplicity", doing all the repetitive tasks that you would normally have to do yourself (& may well make work faster).

    While this may still be "forms over data", it's "forms over data on steroids".


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

  • Friday, November 30, 2012 3:33 AM
    Moderator
     
     

    Garth/Robert,

    I'm happy to join in, if the timing is possible.


    Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands
     
    Please click "Mark as Answer" if a reply answers your question. Please click "Vote as Helpful" , if you find a reply helpful.
     
    By doing this you'll help others to find answers faster.

  • Friday, November 30, 2012 6:13 AM
    Moderator
     
     

    If you feel that "urgent action is required" please log a Connect bug.

    Anyone having significant performance problems that is willing to share their LS project with us can also log a Connect bug noting that you are willing to share the project.  It will be much easier for us to diagnose problems if we can get a project that demonstrates the issues.


    David Kidder | Senior SDET | Microsoft | LightSwitch

  • Friday, November 30, 2012 7:28 AM
     
     

    Hello Yann,

    Ok - it is not simple but also not complex - I think it is a "normal" and typical LOB screen...
    (behind the tabs there are 3 grids and 1 bing map)

    and optimised for "simplicity" doesn't mean that it have to be slowly - there is the biggest software company behind with the necessary resources - so we can expect that they build systems which are running
    in an acceptable performance not only on quad core machines...

    at the weekend I will look and analyse what's going on behind the scenes - what I can't really understand is why the loading of the app takes 30sec?

    at the customer we can add a second vCPU to all Windows7 VM and it brings a small performance improvement

    but I do not understand that in 2012 MS build a system (V2) where we need dual/quadcore machines with a lot of ram to run relatively simple LOB apps.

    look at the sllauncher.exe and the RAM and cpu consumtion - navigation through the screens and scrolling grids consumes a lot of cpu power!

    robert

  • Friday, November 30, 2012 7:29 AM
     
     

    Hello Dave

    at the weekend I will look and analyse what's going on behind the scenes - I hope that ii can find the problem - especially why loading takes up to 30sec

    UPDATE:

    Now I have published my app as a 3 Tier Desktop App - if I start this app it takes "only" a few seconds (max. 10) instead of ~30sec if it is a 2 Tier app - don't know why???

    it seems the problem is the start from vslshost.exe!

    My problem is that I cannot install the app through the browser with one click because of the fact that we use XenDesktop VM's (see Publish 3 Tier Desktop App).

    The rest of the application is still very slow for a LOB Desktop app :-(





    • Edited by Mad Rian Friday, November 30, 2012 4:47 PM
    • Edited by Mad Rian Friday, November 30, 2012 4:53 PM
    • Edited by Mad Rian Friday, November 30, 2012 5:42 PM
    • Edited by Yann DuranModerator Tuesday, January 08, 2013 4:35 AM Fixed link text & removed ) from the end of the URL
    •  
  • Monday, December 03, 2012 8:42 AM
     
     

    Ok, I was asked 'what is Silverlight Hardware acceleration'. I would be surprised if a few people are not experiencing performance problems running on Mac's and some VM's due to lack of hardware acceleration.

    Silverlight Hardware Acceleration

    Silverlight Graphics and Hardware Acceleration

    Those of you utilising H/W acceleration can switch it off to see what it feels like without.

    It is not the answer to everything but important to know for Silverlight.


    Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.


  • Monday, December 03, 2012 9:05 AM
     
     
    I cannot see any difference - is this really a point for LS LOB apps or does this important if you use special graphic operations/animations?
  • Monday, December 03, 2012 1:47 PM
     
     
    Where is this parameter enabling supposed to go? In the .lsml file for the Client?
  • Monday, December 03, 2012 6:05 PM
     
     

    Hello Dave,

    Can you tell me why loading of my 2 Tier Desktop App tales 30sec?

    have published my app as a 3 Tier Desktop App - if I start this app it takes "only" a few seconds (max. 10)  but I cannot use it as a 3 Tier...

    how to speed up loading 2 Tier Desktop App?

    robert

  • Wednesday, December 05, 2012 5:35 PM
     
     

    "XenDesktop VM's " and Silverlight: may not be optimal for running LightSwitch apps.

    In recent years there was problems running WPF .NET 3.5/4 apps too, which after some time had a hotfix. Without knowing your whole environment in detail, I would suggest you investigate graphics optimization in the Citrix VM's to see if any patches or config can improve performance.

    Go compare performance (of grids for sure) Citrix vs decent new non-VM environment PC/laptop. That will show if you have a problem in the graphics/VM area.

    The app start up time is a different issue.


    Dave Baker | Xpert360 blog | twitter : @xpert360 Opinions are my own. Please mark as answer if this helps solve your problem.

  • Wednesday, December 05, 2012 5:49 PM
     
     

    Hi,

    it has nothing to do with the XenDesktop VM's - in comparison with my development machine the ratio is ok - the app start's also slow on my development machine and is also not fast to work with there - and I have a very fast machine (i7 Win7 x64 8GB SSD's)

    I think there is a generell problem with LS/Silverlight
    (look at the cpu if you work with your LS app)

    robert

    PS: we are also running other silverlight apps without problems (Lync)

  • Monday, December 17, 2012 2:45 PM
     
     

    Hi,

    what I understood now is:
    - You are using 2Tier applications where the frontend and application services will run on the same computer
    - You are using virtual systems (maybe with just 1 virtusl CPU/Core)
    - 3tier applications are much faster on your systems

    In a 2tier application, your system always has to take care of multiple things at the same time. If we make it as trivial as possible, we could talk about 2 processes that are running at the same time. One process is responsible for displaying data on the screen and interacting with the user. The other process is responsible to deliver data from the database to the client and vice versa (Including custom logic that you might have build in here).

    So when the client starts, multiple things must be done at the same time on the client. But if you have just one processor / core, then there is no multitasking. What you see as multitasking is just a quick switching between the processes. And yes: That cost a lot of performance.

    I would also think twice about using a 2tier model in a production environment. I simply do not like to grant direct clients access to my databases. The application services are a nice layer of security in my eyes. (But that is not really on topic here. The main point is the performance in here).

    So at the moment the behaviour could be explained if the points on top are all true. And yes - adding another core or CPU to a client will improve speed because then the 2 processes can run completly in parallel. (It might still take a little longer than a 3 tier application where the application services will be up an running already. The first start might take some longer because the ApplicationPool could take some time to start up...)

    Does this information help a little bit?

    With kind regards,

    Konrad

  • Monday, January 07, 2013 11:42 PM
     
     

    Here's how I might tackle general performance problems:

    1. Use Process Explorer from live.sysinternals.com. You might be able to see the stack trace and roughly figure out where the app is slow. Just take a quick look to see if you can find anything that stands out.
    2. Turn off screens and collapse views and see if you are having general performance issues or one particular screen is causing the problem.
    3. DataGrids can spend a lot of time computing heights when laying out controls. If you have DataTemplates, try to fix their heights.
  • Tuesday, January 08, 2013 8:55 AM
     
     

    In my project/screen the problem seems to be the datagrid(s) but after hours of testing I cannot speed up the grids

    what do you mean with "If you have DataTemplates, try to fix their height"?

    one interesting side effect is that on those screens also the closing of the screen takes very long (> 5 seconds) - why?

    robert

  • Tuesday, January 08, 2013 2:47 PM
     
     

    have you tried lazy loading the tabs?

    have you tried a profiler like jetbrains dot trace - maybe the trial.

    I believe that ls silverlight has some crazy context switching going on when binding controls (thats why the quad core is seeing relatively good step up) -  they had to avoid locking at all costs as I believe its a no go for silverlight:

    http://channel9.msdn.com/shows/Going+Deep/Steve-Anonsen-and-John-Rivard-Inside-LightSwitch/

    thats why you will get that effect of a grid building up the rows on a slow system.

    good luck



  • Tuesday, January 08, 2013 2:58 PM
     
     
    on closing there must be a check for dirty records to follow through with the unit of work. there might be a work around if you dont care about that functionality that can just return false - so that the screen closes quicker - maybe someone else on here has done this?
  • Friday, January 11, 2013 11:58 AM
     
     

    that sounds interesting - closing of my screen is also slow if nothing was changed - can anyone from the LS team explain why this exists?

    is it possible to make it quicker?

    robert