I have a very basic MVC page. All it does is reads the url the user is using, pulls the subdomain from the url, compares that subdomain against some values in a database, & then redirects to another page. But it's loading very slow. About 30 seconds. There's very little to my code. It has something to do with what's loading ahead of time.
You can try the link here to see for yourself
In my tests, it takes about 30 seconds to load initially. If I try it multiple times, it's fine. It's just that 1st load. In my debugging, I experience the same problem. It's something during loading because the slowdown happens before I hit my 1st line of code.
How can I determine where the issue's coming from? I do see visual studio 2015 loaded a TON of DLL's into my MVC project when I created it, many of which I'm not using. Could this be the culprit? Here are most of them:
You can definitely get rid of some of those references.
There is one thing to keep in mind though.
The first time you run your website the code will be compiled, files copied over to the ASP.Net Temporary Folder ( 32 or 64 bit version ). This part will always introduce a delay.
When you run the website for real, as in from a proper server and IIS, the same thing will happen, the first request takes a bit of time to load. Subsequent calls will be instant as all the files are available, until there is a gap in usage. If your website is not used for a period of 20 minutes, let's say, the first request after that will again take some time.
You can speed up the bits which are within your control, like the size of the page, how many libraries you're loading, how big they are, images etc. There are online tools around which will give you an indication of where to look. YSLow is such a tool.
For better performance, if you are only using Razor as your view engine, then remove the WebForms view engine.
See this article http://www.dotnet-tricks.com/Tutorial/mvc/aDN4031112-Removing-the-Web-Form-View-Engine-for-better-performance-of-Razor-View-Engine.html
It looks like your pictures are what's slowing you down (campus background, graduate viewbook, etc.). These get cached locally and that's why you only experience the slowness on the initial load. Can you make these images smaller?
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'm developing on a big EpiServer site. When the site starts it takes several minutes and you can see what happens in the VS.NET diagnostic tools. There are a lot of database calls (2400+). E.g. netPageDefinitionGet, netPageDefinitionList.
From what I understand the results of this will be inserted into the EpiServer cache. The site performs well when started.
This isn't really a problem when running the site, it's a problem when developing. Since this delay happens every time a developer starts the debugger, this causes lot's of wait time for all developers..
Any suggestions? Is it possible to keep the cache e.g. out of process between debugging sessions?
360 content types is fairly high, so it might be that model synchronization is taking a long time.
You could try setting EnableModelSyncCommit to false in config to see if that speeds things up.
Note however that content types will no longer automatically be updated when content types are changed in code.
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 ?
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.