Is there something akin to the 'Django Debug Toolbar' for ASP.NET (and more specifically ASP.NET MVC).
It's an HTML page overlay that shows total execution time, SQL queries (and time), what views were called... etc.
I'm a bit late with the answer. The mini profiler does just that. You can see it in action at http://data.stackexchange.com (top left corner).
I use a HttpModule like this one to log request performance information.
Glimpse:
The Diagnostics platform of the web
Providing real time diagnostics & insights to the fingertips of hundreds of thousands of developers daily
Live demo: http://play.getglimpse.com/
Glimpse Heads-Up Display (HUD) is a mini dashboard that pulls out the most important details about a request and displays it at the bottom of your page.
From the HUD, you can dive down into another level of information by clicking on the "G" in the lower right corner. When the Main Panel opens you will be presented with a series of tabs which offer a range of insights into your application.
Core tabs:
Ajax
History
Timeline
Trace
ASP.NET tabs:
Cache
Configuration
Environment
Request
Routes
Server
Session
ASP.NET MVC specific tabs:
Execution
Model Binding
Metadata
Views
EF tabs:
SQL
If you are using EF, NH or L2S you can check awesome http://hibernatingrhinos.com/products/UberProf . It'll help you with sql queries and will warn you about some bad practices (select N+1, etc.).
ELMAH may be useful for you too.
And to measure time on server side try checking the time between OnResultExecuting/OnResultExecuted. This is basically the time to actually render the page in HTML.
On client side you can use Firebug extension to Firefox, check Network tab
No, nothing I'm aware of.
If you're using WebForms as your views you can get the name of the rendered view from standard ASP.NET trace (set , then navigate to {approot}/trace.axd). And if you're using SQL Server as your DBMS use Profiler to see queries.
Related
We developed a C# .Net Core 2.0 app with a SQL Server back-end. Now we want to add reports. We're looking for guidance on how to best implement reporting.
So far we see two options at our disposal
1. SSRS (Sql Server Reporting Service)
2. Telerik Reporting
But we are not sure of the best practice for implementing either option. Looking for guidance. Articles and examples we've found so far are either incorrect or obsolete.
We would like to display the reports within the app [ReportViewer], but if that's not possible rendering the report in a new browser tab is acceptable.
You could accomplish this with wkhtmltopdf, a headless instance of chrome, and Razor pages. This gives you the ability to implement reports using code and processes you're already familiar with.
You'll do this by building a Reports Controller, with an endpoint for each Report you'll want to generate. Have the endpoint return a View as normal.
Your converter will want to point itsself at this endpoint. The returned view will be rendered to a PDF. Alternatively, these views can be rendered in the browser as normal. This means you get both without extra work that may be incurred with one of the other solutions.
A little while back, one of the junior developers at our company was tasked with creating a website for users to enter timesheets offsite. Mostly this is used for staff that reside offshore and have limited bandwidth (it's satellite internet, so we're already looking at a 500ms - 600ms response time, typically with only 10KB/s or less, including 10% - 20% intermittent packet loss).
So it's a challenging situation...
Recently I've been tasked with helping the junior to improve the speed and functionality of the website, mostly for my own benefit, since I'm usually a desktop dev. One thing I've noticed is that the website is using MultiView and I'm wondering if that's the best approach. I can see the reasoning; download the entire website once, then just make queries back and forth, showing/hiding the various views as necessary. Except it doesn't seem to work as smoothly as that.
95% of operations required a run by the server; i.e. add a new timesheet - need to tell the server, which in turn creates a new entry in the database. When the server is done, it seems to cause the client to download the entire webpage again, which is obviously counter productive.
So my question(s) are as follows;
Is this the expected behaviour, given the above situation? i.e. Should the entire webpage be getting re-downloaded once the server has completed it's actions?
If so, is this the best approach for the situation? Would it be better to have smaller, individual pages for the various features (timesheets/leave/etc.)?
I know this is probably a bit opinion based, but any ideas or assistance is greatly appreciated; for both our benefits.
Going from memory, Multiview only renders one of the views, not all of them, but since you mention the Multiview, that tells me you are using the older WebForms technology which often carries large amounts of overhead saving/restoring state. You can try and optimize that, especially if you are using some kind of grid control.
A better approach may be to ditch WebForms and switch to a newer technology like MVC. Rewrite the application to use AJAX with a webservice that returns JSON whenever possible to reduce the amount of data that needs to be sent to and from the server. Using MVC will also reduce the number of resources required for a page load (No resource.axd, etc) which will help page load times, especially over high latency links.
Make sure the server is set to compress dynamic pages with GZIP.
Compress and minify your javascript and CSS.
Don't use inline styles (the style attribute) in your HTML (use classes or IDs+children selectors) to reduce HTMLsize.
Bundle all your javascript and CSS.
Sprite your images in CSS where possible.
Run your images through a good image optimizer like http://kraken.io
Make sure you are caching whatever you can, and the cache duration is set properly.
Minify your HTML.
Stop using WebForms (or watch your page state, and control state very closely)
Check into some of the SPA architectures out there -- you may be able to make the whole application "offline-able" with the exception of the calls to get/update/create data.
Ultimately, each page should only require 1 HTML file, 1 CSS file, 1 Javascript file, and 1 sprite sheet on the first page hit, and then every page after that should only require a single HTML file.
You might also want to look into using a client side library like angular or knockout to handle rendering views. This can reduce the amount of traffic that needs to be sent (although it likely will increase the number of requests by one).
I think the best bet is a SPA (Single Page App) with Angularjs. Done right it greatly reduces the number of http requests. Navigation does not cause entire page reload in any case. Javascript files, css files etc, are loaded just one time at app load time. Once the app is loaded in the browser, the traffic is mainly sending JSON back and forth.
There are some tricks you should apply to reduce app load time:
Bundle javascript files into just one minified javascript file.
Bundle css files into just one css file.
Levearage http cache. You can use file versioning combined with MaxAge http header, so the browser does not even ask the server if the file has changed.
Some tools to help:
Fiddler, look at what is being cached and what isn't.
Facebooks augmented Traffic Control
To my understanding, ajax would be the best choice for you. If you want to access server 95% of times and reload the page with the new elements then the performance would hamper.
So instead of doing this make partial reloading with Ajax or Jquery. There are plenty of functionality available with jquery which would use ajax and reload specific portion of the webpage instead of whole page. It would increse the performance a lot.
One more thing I would like to add is that the response packet coming from server might be huge chunk. So instead of directly throwing the response from the server, implement GZip functionality in the website. It would compress the size of the data packet and the page would load/reload much faster.
Other than these, place your CSS and JS code inside some .css and .js file instead of placing it inside the page itself(and make sure to use it maximum time from all the pages). Browser would make a cache version of those files and reuse it instead of download it every time you want to connect to the server.
I believe that you have already figured out what's wrong. No Multiview is not good if it is implemented as is without tweaks. If your website uses viewstate and on top of that you have the multiview implemented, then it is going to be a costly affair.
Here are your options.
To use most out of the code, I would recommend to convert your methods HTTP GET / POST methods which can be then called separately from the needed actions in the html.
Don't re-render the entire page, but render the content which changes on menu action.
Change the non-changing part of your page / site to static content and apply compression on the static contents.
Enable page caching.
Cache the data offline wherever possible. (Remember it comes with a overhead of syncing data).
If you are considering a revamp give a thought about HTML 5 offline features.
I am developing a website in which I want to use ASP.NET MVC 5 because the site has the potential to be quite large and require the separation of concerns that MVC provides. However, the client wants me to show him a "prototype" of the home page which is simplay a single page that shows an image, some text, and requires a user login (and he wants to see it ASAP). How can I reconcile the fact that developing a proper ASP.NET MVC site requries a large amount of initial time to set up with my requirement to quickly put together a page to show my client what he has in mind? Should Also, should I consider using Web Forms over Razor for this initial part of the site?
You can prototype it fast just by modifying default view, without creating models controllers etc.
Login functionallity exists out of the box in MVC.
You can download one of MVC templates from Visual Studio.
Select File > New Project > Online > Templates.
You can find them also here (most of them are kept are up to date): https://visualstudiogallery.msdn.microsoft.com/site/search?query=mvc&f[1].Value=mvc&f[1].Type=SearchText&f[0].Value=templates&f[0].Type=RootCategory&ac=4
The Visual Studio Single Page Application template is super quick to setup. It'll run right out of the box. Just add your image and text to the Home view.
I have a dot net web application. There is one page where we enter data & submit the form.We upload the attachment before submitting the form.The submit action is taking long time almost minute for files with attachment of 650KB. The code behind is C#. We use third party API(Ektron).Its a CMS tool.
Please let me know , in what all ways i can analyse the bottle neck for the issue.Please provide open source Tool & the browser addons.. other than Page speed & Yslow .
Please check if the time taken is for the request to initiate or the response to comeback to your browser..
It is only then you can look for a solution..
To answer the second half of your question. At the very least most modern browsers (FireFox, Chrome and Safari) have a developer console that will give you a breakdown of the times taken in each request state on a per request basis. My personal preference is FireFox with FireBug as I find the Network pane view easy to interpret.
Redgate ANTS Performance Profiler is pretty much the bees knees for troubleshooting performance problems in ASP.net.
my scenario is this; the user selects the list of reports they wish to print, once they select and click on the a button, i open up another page with the selected reports ready for printing. I am using a session variable to pass reports from one page to another.
first time you try it, it works fine, second time you try it, it opens the report window with the previous selected reports. I have to refresh the page to make sure it loads the latest selections.
is there a way to get the latest value from the session every time you use it? or is there a better way to solve this problem. open for suggestions...
Thanks
C# Asp.net, IE&7 /IE 8
After doing some more checking maybe if you check out COMET it might help.
The idea is that you can have code in your second page which will keep checking the server for updated values every few seconds and if it finds updated values it will refresh itself.
There are 2 very good links explaining the imlementation.
Scalable COMET Combined with ASP.NET
Scalable COMET Combined with ASP.NET - Part 2
The first link explains what COMET is and how it ties in with ASP.NET, the second link has an example using a chat room. However, I'm sure the code querying for updates will be pretty generic and can be applied to your scenario.
I have never implemented COMET yet so I'm not sure how complex it is or if it is easy to implement into your solution.
Maybe someone developing the SO application is able to resolve this issue for you. SO uses some real-time feature for the notifications on a page, i.e: You are in the middle of writing an answer and a message pops up in your client letting you know someone else has added an answer and to click "here" to refresh.
The proper fix is to set the caching directives on the HTTP response correctly, so that the cached response is not reused without validation from the server.
When you fail to specify the cache lifetime, the client has to "guess" how long the response is good for, and the browser's guess probably isn't what you want. See http://blogs.msdn.com/b/ie/archive/2010/07/14/caching-improvements-in-internet-explorer-9.aspx
It's better to use URL paramaters. So you have a view of value of the paramaters.