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!
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.
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
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
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.
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
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
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.