When designing a ASP.net WebForm application what are some important steps to take (or hacks if you like to use the term) to ensure the best possible performance (in terms of speed, stability, and scalability)?
Avoid round trips to server
Wherever possible user AJAX calls.
Implement Caching.
Avoid using Viewstate wherever possible
For further more read these links.
Improve Web Application Performance
ASP.NET Web Site Performance Improvement
Since so many things can affect performance, it's difficult to provide such a list. We may make assumptions about your code that aren't correct, and may focus on the wrong areas while you suffer poor performance from something we would otherwise take for granted.
Having said that, in general you might keep an eye on:
Don't over-use ViewState. (I'd argue not to use it at all, but that's another issue entirely.)
Keep page resources small (minified text, good image encoding, etc.).
Ensure page resources are properly cached once downloaded.
Try to move most UX logic client-side. (Avoid post-backs for things you can otherwise do in JavaScript, fetch data asynchronously where possible in small chunks, etc.)
The list can go on and on, and that's just with the web tier of the application. You could easily encounter site performance problems resulting from slow server-side code or server-side resource dependencies (database, etc.) that can't be debugged in the browser.
So the main point is to learn your debugging tools. Through combinations of browser tools (FireBug, Chrome Developer tools, etc.), Visual Studio debugging (or whatever else you may use for your .NET code), good logging, and even profiling tools you can identify your bottlenecks and tweak your system accordingly.
Check your website in google page speed :click
It will give your problem . for unwanted style.images and etc.......
If you care so much for speed, stability and scalability you might first question whether ASP itself is a good compromise
when it comes to performance of the web application we need to consider many things this article will help you understand what performance is where to start.
In web application 80 percent of the time it is front end which requires performance optimization, what needed to be optimized is a big question and really hard to answer
this article i found will help you understand the web performance optimization
Web Performance Optimization
Related
I am quite new to running websites in general. I am familiar with statistical profilers for desktop applications, but unsure how to even begin profiling a website as there are a lot of additional potential bottlenecks and I'm not sure what profilers are available for websites.
I have looked around and seen useful suggestions in other questions, but I am not sure they are a very complete solution. The main suggestions are azure performance counters and suggestions from this answer.
Summarizing they are:
Use firebug to determine rendering time and loading time seperately so one can tell whether one has a rendering issue or a server issue.
If server side:
Test a small static page like a page with a single gif. If that is slow one has a CPU issue. Otherwise one is probably IO bound or has problems with database performance.
One can use performance counters to check server aspects such as:
memory
garbage collection
tcp/ip issues
bytes sent / recieved
requests requested, queued, rejected
request wait time, processing time
From my naive standpoint some things that seem to be missing from this list are the sort of profiling one has for a traditional desktop application, i.e. what the stack looked like what percentage of the time (i.e. what functions were we spending time in, and in what context). Another missing item is profiling the database performance, which seems like it may be different on azure than in a local environment especially if one starts dealing with scaling. Another is time spent on requests to third party services, though maybe that can be done with azure performance counters(?).
I apologize for the naive nature of this question. What tools and aspects am I missing here to profile an azure MVC asp.net website and what changes would you make to the above list?
There's a lot of aspects to profiling a site, in terms of database calls, business logic, rendering a view, and even client side performance (any jQuery that might run, for example).
StackOverflow's MiniProfiler is one of the easiest things to get going, just install a NuGet package, add some Javascript includes, and wrap whatever you want to test inside a using() block, and you'll see execution times (including LINQ-to-SQL and EF). You can even create steps if you want finer grained timings of individual calls.
The nice thing about MiniProfiler is you can enable/disable based on the environment, which makes it suitable for running inside Azure (as opposed to say, the Visual Studio Profiler).
You can also look at Azure Performance Counters, which will give you an idea of system resources, but isn't profiling in the sense that MiniProfiler is. It will however give you an idea of network latency and CPU and memory utilization.
Once you're satisfied there, you can use Chrome's Developer Tools to profile your application on the client side. It'll give you an idea of how well your Javascript is doing, including CSS selectors and rendering.
Also worth noting, Visual Studio has a really good Profiler in some higher editions that can give you deep insights into your code. Time spent in methods, call counts, etc.
Between these four methods, you should be able to find most bottlenecks, especially for a first pass.
Can any help regarding the performance improvement in Asp.Net?The best practise tips for asp.net performance improvement?
This is a very broad question to answer because the Performance of an ASP.Net application is not only bound to page processing or bandwidth usage but also in the code and Algorithms you have written. If you use data source then the Performance of the Queries and ADo.Net. The Basic thing you might be asking is to improve page processing by Caching, etc..
Have a look here for a detailed description of Best Patterns and Practice (Though its old ..published in 2004 but still helps).
http://msdn.microsoft.com/en-us/library/ff647215.aspx
Or better consider this (For .Net4) . It list all performance related Documentation
http://msdn.microsoft.com/en-us/library/cc668225.aspx
Update
If you are looking for specific stuff slowing your page load
Use firebug's Net panel and monitor which resource is taking more time. Or as suggested by another answer use Tracing to check this out.
What is the best drug to get healthier? It all depends on what is your health problem. The same thing is with ASP.NET performance. First, find what is your bottleneck, a single most slow down factor. Then fix it, retest performance and, if more speed is necessary, go to the previous step.
How to find a bottleneck? If you really have no clue where to start, then start from analyzing your waterfall diagram. To create one from your client, use Fiddler or Firebug. To create it from different Internet geographies use WebPagetest. The waterfall will show whether the bottleneck is on the server or network, and also whether it is caused by main ASPX page or by resources (scripts, images, CSS). If the server and network are fast enough, then check slowness in the browser using Firebug or dynaTrace Ajax edition that can trace DOMContentLoaded/load events in browser. If the bottleneck is on the server, find out whether it is the database or application. Use database profiler and .NET profiler, for example from this question.
How to fix bottlenecks? Check this Microsoft resource, but there are many others for each type of bottlenecks.
If you add the “performance“ tag to your question you may get more answers.
Set trace="true" in the page directive. Reload the page and look for any obvious delays in the page life-cycle event handlers, particularly where you are accessing a database.
Also, use the Firefox Web Developer toolbar to obtain a friendly overview of the image file sizes and other static file sizes, CSS, JS, etc.
There are lots of questions and answers on ASP.NET performance here on Stackoverflow. Here's one of my previous answers and a quick search on the ASP.NET and Performance tags yields plenty of results.
What problems are you facing exactly?
I have a pretty big web site (asp.net web) and I have used JavaScript intensively (jquery,custom javascipt, etc) and also The theme and CSS. Right now I have a huge amount of js and css files in my system and I am thinking about minifying and smashing the js and css to improve the performance. So, please advice me the suitable tools and technologies to be used and please suggest me the best practices to be applied in these scenario.
There are a couple of things you could try to improve performance.
Enable GZIP
Enable 'Retail' attribute in machine.config
Enable Page Caching
I've listed the techniques we have used at our organisation to improve the performance of our web applications. With the exception of GZIP the other two probably won't have a direct effect on the JS and CSS files but will save you valuable loading time in other areas making your web site much faster.
We always see huge increases in speed and performance when the retail attribute is set to 'True' - all forms of debugging are disabled in this mode which makes the site more responsive.
Obviously you only want this setting on your live server.
If you're using jQuery, you should already be using the minified version on your production site.
For your own Javascript, there's Douglas Crockford's original minifier, or you could use the Microsoft Ajax Minifier, which you can add as an MSBuild task - there's an overview here.
There's a number of CSS minifiers referenced in the answers to this SO question.
Best practices are great but, at least in the case of performance, the question is more about the right practice. The only way to know is to:
Measure
Try
Measure Again
Compare/Contrast
It is almost always a trade-off with optimizing software. You have to consider how a change effects readability, scalability, security, deployment complexity, and probably a lot of other ity's I am not thinking of.
Having said all that the practices you are looking for are pretty much here.
To make my point though consider the rule Use a CDN. This seems like an obvious choice for something universal like jquery. You can use both MSFT and Google for this. You have the potential advantage of parallel download (depending up on the client browser) and the added possibility of already being in the client cache (from other site they may have visited). Plus they are likely serving it closer to the user than you are.
But the trade off to consider is that it is going to eat some bandwidth so if you are building something that is sitting in the Intranet, don't do this. You also introduce the possibility of failure from an external source. You can work around that by adding more code.
Perhaps most importantly though is that using a CDN is in direct contrast to the first rule, reduce HTTP requests. If you can combine and minimize all your js and load it more efficiently locally then you should do so. How do you know?
You have to:
Measure
Try
Measure Again
Compare/Contrast
Have fun!
what are the things a developer should keep in mind or should take care when depeloping a web application.
web application e.g. social networking web app.
which are the things which must be implemented to get good performance and scalability.
please provide any article or blogs or suggestions for this kind of question if you have
-thanks in advance
Some things that popped up in my mind
build in caching
keep code clean and (unit) testable
messure code coverage
optimize database with indexs and check execution plans
refactor every thing you build
optimize front end loading time (minification, gzip, compressing)
use source control
Deactivate Viewstate where you don't need it.
Most important:
Make sure to hold the amount of roundtrips as small as possible. Understanding the Life-Cyclus of an asp.net website is most important for that matter.
http://www.startvbdotnet.com/aspsite/forms/formlifecycle.aspx
I have a portfolio made in C#/ASP.NET which started off small but, as it is selling myself, it has grown in size very quickly.
I started off with using ASP.NET webforms model but this has meant that some of my code is in class libraries (.dlls) and some in page codebehind.
I want to fix this (no defined stucture), but without the overhead of migrating to ASP.NET MVC or WCSF.
How could I address these problems? I am thinking of moving all logic to WCF services and calling them from page codebehind. Is there a better way?
EDIT: The current problem is codebehind (used only as the site was small at the start but now it gets a lot of attention from me with updates). I want to seperate this all out so it's easy to test (what MVC addresses), and the coupling is generally low. Is it enough to use WCF to achieve this? What other techniques could I employ? Maintainability is another concern because maintaining a codebase split between .dlls is awkward (when debugging, as I noticed and mentioned in some previous threads).
Thanks
Unfortunately, traditional web forms applications are damn near impossible to test. WCF won't be of much help because it's a communications technology that will help you to get the data to codebehind classes but won't help you to render or test pages.
Due to this complexity, there are very few test automation tools, and the few there are are commercial paid-for products. One such tool I have heard of, but have not used personally, is Ivonna. You can also test using browser automation. Two great tools to help with this purpose are watin and WebAii.
This is, of course, dependent on whether you still want to keep the original code lying around. What I take in when I read your post is that you want all of the benefits of MVC. Unfortunately, it may be best to take the plunge and rewrite the application. It's painful, I know, but the sheer amount of hackery to make WebForms ape MVC concepts is overwhelming, to say the least.
I cant fully imagine what you need, but consider URL redirection / slug