We have an ASP.Net Webforms site (.Net 3.5) that has about 100 references in the project, so it's not tiny. Reuilding the site takes maybe 20-30 seconds but it's the load time that's a killer. At least 5 minutes before the first page opens in the browser on our development machines. We're building in VS 2012 fwiw.
What can we do to speed things up? There's an 'optimizeCompilation' flag you can put into web.config, and that's helped a little but not as much as we'd hoped. Is there a checklist we can go through to try and find the real bottlenecks in the site load time?
I can state that when the site is coming up the ASP.Net Temporary files folder slowly accumulates files. When all is said and done there are about 2500 files in there, ~70MB total size. It almost feels like we can hand-write the contents of that folder using Notepad faster than ASP.Net puts them in there.
What difference do you get if you change from Debug to Release ?
Also, have a look at native image generation:
Does it help to use NGEN?
Lastly, 100 references seems excessive! What are you doing with them? Is it your own code? Can you consolidate your own code into single projects ?
Do some of these references themselves reference web services or anything like that ?
Related
I have some major performance issues regarding my ASP.NET web application. Navigation between pages etc. is fine, but the initial startup (in any mode) takes up to several minutes. Visual Studio seems to be busy loading symbols in this long period of time - especially temporary asp.net files... I've tried several different supposed solutions that I've found on Google; like caching the symbols, enabling just my code, deleting all breakpoints, deleting the Temporary ASP.NET Files folder and most of the tips on this site:
http://blog.lavablast.com/post/2010/12/01/Slash-your-ASPNET-compileload-time.aspx
and this:
https://blogs.msdn.microsoft.com/visualstudioalm/2015/03/03/make-debugging-faster-with-visual-studio/
, but without any luck - not even a slight performance improvement.
I don't really know how to troubleshoot it properly, so feel free to ask me to try something - I'm spending almost en hour every day waiting for my application to start, so I'm ready to try anything. I'm using Visual Studio 2012.
EDIT: I looks like it loads the symbols for the Temporary ASP.NET Files every time, instead of using the ones already there, and there is SO many files that it makes sense that it takes a while to load them all... Is there a way to stop it from loading them all from the beginning on every single startup?
For me the best solution for slow first load after some modifications made was to set this in web.config of my developer machine:
<compilation batch="false"></compilation>
When an ASP.NET website is loaded for the first time, it pre-compiles
all your pages and user controls. Once done, everything runs faster.
This is great for production websites, but horrible for your
development machine. Why? When programming, you’re usually only
modifying a page or two (or back-end code). You’ll iteratively make a
change, compile, launch the website, test, and start over; often
dozens of times. A two minute compile/load time (like we had) forces
you to lose focus and get distracted. The following setting makes
pre-compilation more selective, making the first load time massively
faster in development scenarios. On my machine, it cut the first load
time from around 74 seconds to 6 seconds.
You can check other performance tips here: http://blog.lavablast.com/post/2010/12/01/Slash-your-ASPNET-compileload-time.aspx
I've gotten thrown into a WebForms ASP.NET 3.5 project on VS2008. The solution has 5 projects, so not too large. One thing that really annoys me is how long it takes go to from F5 to an actual web page that I can do something about (good 15-20 seconds). The box I am on is relatively recent - everything else on it feels really snappy.
What are some of the things I can do to speed up this process?
If you don't need to debug, don't do it. What I do is start the project without debugging (ctrl + F5). you've now got a window attached to VS. All you need to do now is rebuild your code when you make code changes, which is much quicker.
Simon
Directly reference the dlls instead of the projects.(If the referenced projects are compiled in release mode that's better)
Set optimizeCompilations=”true” :
When you experience very slow performance on
an initial request to an ASP.NET Web site after you change the
App_Code folder, the bin folder, or the Global.asax file.Turning on this flag will improve the performance.
Use Combress (http://combres.codeplex.com/) to minify css and javascript files.
Enable Gzip compression to reduce the network traffic on the network.This may reduce the network traffic by more than 50%.
http://developer.yahoo.com/performance/rules.html.
try to implement the best coding practices.
These things will definitely improve the performance of the site.
I have tried looking at "related" questions for answers to this but they don't seem to actually be related...
Basically I have a VB.Net application with a catalogue, administration section (which can alter the catalogue, monitor page views etc etc) and other basic pages on the customer front end.
When I compile and run the app on my local machine it seems to compile fairly quickly and run very fast. However when deployed on the server it seems to take forever and a day on the very first page load (no matter what page it is, how many stylesheets / JS files there are, how many images there are, how big the page markup is and so on). After this ALL the pages load really fast. My guess is this is due to having to load the code from scratch; after that, until it is recycled, the application runs perfectly fast. Does anyone have any idea how I could speed this part of the application up? I am afraid that some customers (on slow connections such as my own at less than dial-up speed) may be leaving the site never to return as a result of it not loading fast enough. Any help would be greatly appreciated.
Thanks in advance.
Regards,
Richard
PS If you refer to some of my other questions you will find out a bit more about the system, such as the fact that most of the data is loaded into objects on the first page load - I am slowly sorting this out but it does not appear to be making all that much of a difference. I have considered using Linq-to-SQL instead but that, as far as I know, does not give me too much flexibility. I would rather define my own system architecture and make it specific to the company, rather than working within the restrictions of Linq-to-SQL.
If you can, the quickest easiest solution is simply to configure the AppDomain not to recycle after a period of inactivity. How this is accomplished differs between IIS 6 & IIS 7.
Another option is to write a small utility program that requests a page from your site every 4 minutes and set it up as a scheduled task on another PC that is on all the time. That at least will prevent the timeout and consequent AppDomain recycle from happening. It is a hack, to be sure, but sometimes any solution is better than none.
The proper solution, however, is to precompile your views. How exactly to accomplish and deploy that will depend on the exact type of Visual Studio project your web site is.
I have been programming in php for a while, and recently I started a new job ago where I am now programming in c#/asp.net.
While asp has decent performance when deployed, there is one thing that has been bugging me for the past few months. After any code change it takes about 30 seconds for the page to reload for testing.
I guess it is doing the JIT compiling or something. But it can be REALLY frustrating, especially if I am concentrating, and want to test out several incremental changes as quickly as possible, only to have to stare at a blank page for 30 seconds.
Does anyone have any tips to speed this process up?
In Visual studio 2005 every reference you add adds a .refresh file that makes sure the reference did not change since last time and if so brings the new version - if your references stay the same, you can just remove it!
also see here for more tips for VS 2005
Two things I have found:
Try alternating between the "User Visual Studio Development Server" and "Local IIS Server" in your project properties / Web tab. Depending on your project, one may be faster to start and attach to than the other.
If you have projects in your solution, such as CLR-based SQL procedures, they take a few seconds to deploy to the SQL server. If you can afford to remember to turn them back on, or make a separate project config, disable them in the build so they do not get deployed every time you press F5.
Doing those cut my "F5 to live" time from about 20 seconds to 4.
I guess that can be frustrating coming from PHP.
Thirty seconds sounds far too long though. Ensure the basics like free ram etc..
A couple of tips.
1. You do not have to run the debugger in order to run the site. Once you have the site up with the built in VS web server or IIS, you can make your code changes, build and just refresh the page in your browser. No need to hit play and have VS start the whole debug process. If you actually want to debug though, you don't have a choice.
2. Changes to an aspx page do not require a rebuild. I make changes and simply refresh the page to see the result instantly.
Check out the web tab in the project settings to configure how you want VS to handle serving the site. There are some options in there to hopefully help you suite it to your style. ex. I don't let VS launch a browser for me whenever I want to debug. I set the option for it to just wait for a request. Then I can just use the browser of my choice to get started.
Good luck
I feel your pain.
Personnaly I like the ASP.NET website project better for speed of developing.
I don't know if you have that possibility though..
In visual studio do file->new website.
For this project type you don't need a rebuild all the time and you can just refresh a page in your browser when you have changed it. (no rebuild/debug necessary)
I've had similar experiences, it can be slow to recompile at times, but varies based on where and what code is being changed - ie if it is app_code or just page specific.
What sort of hardware are you running on? VS can be a memory hog, and anything less than 2GB seems to make it slow.
Our website has a very long load time due to actions which only occur during the Application Start phase (when the ASP worker process starts). In particular loading commonly used objects from a database into memory was causing a significant delay. We found that using compilation symbols to disable some features when debugging eg security and user roles, helped a lot.
We're developing web applications using DotNetNuke as a framework and our custom modules for required functionality. The problem is, that it takes a long time for the website to load when you do any changes to code. I'm looking at up to 1 minute for each restart, which really is painfully slow. This leads to very slow develop-rebuild-test cycle.
We're using both console projects and winforms projects as testing ground for new functionality for faster development, but still there is lots of UI functionality that has to be done with a browser.
Does anyone have any tips on how to speed up/prevent the appdomain restart that occurs when something changes in the bin folder of a web app?
DNN does a compile on demand when you add/change pages, if you pre-compile them your turn around time should be much faster.
You're bumping up against a drawback of ASP.NET, when used with large web apps.
DotNetNuke has many significant DLLs and VB files that will all have to be reprocessed if all you do is change one single DLL. If you have 50 Module DLL's in your bin, all 50 Module DLL's will be reprocessed by ASP.Net upon your next application request.
Here is my suggestion:
Hook up the following folders to your source control (not your entire DNN folder):
bin (I suggest ignoring all DNN DLL's, so upgrades go smoother)
Portals_default\Skins
Portals_default\Containers
js
DesktopModules (ignore Admin or any built in modules)
images (ignore the core DNN images if you wish, or any of your own clunky images folders like thousands of customer photos)
(optional) CompanyName\ (where you might wish to keep other .NET Projects that need relative access to DLL's in the bin folder)
When one of your developers requires repetitive compiles / page loads, he will benefit most by eliminating as many DLL's in the bin folder as possible. It will also help to use a barebones skin for testing, if you can (They are very easy to make).
The barebones skin (which should utilize 1 or 2 skin objects, at most) and an absolute minimum of DLL's (DNN Core + the bare minimum of your own) will get you the best speed for development.
When your developer is done with the focused development of the one module, he can update those folders which he deleted items from source control (svn here), finish testing his code in the context of the full DLL/Skin set, and he'll be set.
Sometimes it is worth the trouble. I can't get you down to a few seconds of ASP.NET reprocessing, but I can get you down to 10-15 seconds. (assuming you're running on an SSD)
As far as production restarts, make sure your APP Pool recycles during off-hours.
I've looked into whether multi-core setups can somehow decrease this reprocessing time, but haven't had any luck (I have an open question on serverfault)
Maybe this would help you?
Speeding up build times in ASP.NET