ASP.NET shopping cart takes FOREVER to initially load

Discussion in 'C#' started by Shirtfight, Aug 1, 2006.

  1. #1
    hey guys,

    so I've spent all this money on a really kick ass shopping cart written in .NET (C#), and i've got the site up now at Shirt Fight...i don't have a lot of traffic yet (working on it!) but the initial loading of the site is dog slow!

    Once the initial loading (which i'm assuming is the application loading into memory?) is done then the site is great.

    Is this common? what can I do to prevent this?

    Thanks!
     
    Shirtfight, Aug 1, 2006 IP
  2. rumblepup

    rumblepup Peon

    Messages:
    100
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It's very common for a website written in .net to run slow on the initial load. Remember, your .net site is really not static pages, but a PROGRAM that will RENDER html. Just like any program you have, Word, Excel, Photoshop, when the program has not been run in a while, then it will turn on ....very....slowly....and...then....start....to work. Then itsfastasblazesandyouhavenoideawhatjusthappened.

    Your dll's are not staying in cache long enough for your asp.net application to stay active. Your webhost might be able to help you this, if they have a Keep-alive service. Also, specify in your web.config file how long you want the dll's to stay in cache. Check out 4guysfromrolla.com for more information on this.

    Another thing to check is this. Did you deploy your source code, or the application files? Did you develop in VS.net?

    If you developed in VS.net, you can run your tests in debug mode until your ready to release, and then, when your ready to release, you "build" your application in release mode, then "copy" only the files needed to run the application.

    You can run both .net source and application files. Both will work, however, when you deploy your full source code, basically, everytime a page is called, you are building your application from the ground up as well.
     
    rumblepup, Aug 1, 2006 IP
  3. Shirtfight

    Shirtfight Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hey thanks for the tips! I'll check into all of that now :D
     
    Shirtfight, Aug 1, 2006 IP
  4. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    hi,

    this used to be a real problem with .Net 1.1 where the first person to access the newly uploaded code suffered the overhead of pre-compiling the whole application. At .Net 2 you can build the application and upload the object files instead of the source code. Since I started doing that I haven't experienced any of these delays at all.

    regards

    FBJ
     
    Free Born John, Aug 3, 2006 IP
  5. Postingpays

    Postingpays Well-Known Member

    Messages:
    1,071
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    185
    #5
    Yes, this is what microsoft has let us know that ASP.net 2 has resolved such kind of errors. Asp.net 2.0 is much much faster than the previous version. You can use visual studio 2005 for your project as microsoft has released its version not beta:)
     
    Postingpays, Aug 15, 2006 IP
  6. rooneydavid

    rooneydavid Guest

    Messages:
    67
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Did you look at your Trace.axd and see what is going on?? But make sure in the web config that it is turned on. This file will show you the process and time from request to response. Also have you run a copy in debug?? Go through the code and make sure that there is no processes that are lagging. The first run should be slow thats a given. But after that all the process should run faster since the code is in memory. I work for a hotel booking company and our system is C#.NET and we only have visible speed problems when we upload a new version. But the site runs on a dedicated server with 2GBs ram and dual processers.
     
    rooneydavid, Aug 30, 2006 IP
  7. Froggie

    Froggie Well-Known Member

    Messages:
    665
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    120
    #7
    keep in mind that every time you change the web.config you are essentially going to get a restart of the entire application.
    best practise is to upload your changes and you be the first one to run the application once so that rest of the people get a compiled version isntead of hitting that initial state first compile.
    Yes unfortunately the first load time is crap but the rest of it pays off because it loads a lot faster because its already compiled
     
    Froggie, Sep 12, 2006 IP
  8. adacprogramming

    adacprogramming Well-Known Member

    Messages:
    1,615
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    125
    #8
    Also remember there are two places in visual studio that you need to set as a release version.

    The first is in your GUI. set it to Release.
    The second is in web.config set debug to false.

    <compilation
    defaultLanguage="c#"
    debug="false"
    />

    Then compile the program
     
    adacprogramming, Sep 19, 2006 IP
  9. codezilla94

    codezilla94 Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    I had the same problem. The reason is that the application domain times out every 20 mins if there is no activity, the first request after the timeout can force a recompile and reload of cache. Changing some settings in the machine.config file will solve the problem; unfortunately for me my hosting provider would not allow me to make this change. I found this utility to be useful.

    http://www.spikesolutions.net/ViewSolution.aspx?ID=c2b7edc0-5de1-4064-a432-05f6eded3b82

    Essentially it "Pings" my home page every few mins so the application domain does not time out. The utility can also be configured to ping more than one page so that auxiliary pages are fast too.
     
    codezilla94, Nov 12, 2007 IP
  10. shoaeeb

    shoaeeb Peon

    Messages:
    165
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Its very common case for such kinda carts.
     
    shoaeeb, Jul 24, 2008 IP