Response times varying significantly in MVC app - asp.net-mvc

I have an asp mvc app hosted at www.jacquelinewhite.co.uk. When I use firebug (net tab or page speed) I'm seeing response times of 200 milliseconds for an action that isn't cached and about 30 for a cached action result. However, my reports from pingdom.com are showing an average of between 3 and 7 seconds for a response.
The application is set not to recycle and sits at a consistent memory level. I can't see any CPU spikes and basically everything looks fine, except the response times are a lot slower than I'd hope for.
I'm inclined to think it's not a problem with pingdom and the google webmaster tools shows the sites as slower than 54% of other sites.
Where else might I look at to identify the sites slowness?

Well, as luck would have it, the Stackoverflow team has just released an MVC Profiler (which was originally developed to profile this family of sites). The profiler is available from code.google.com/p/mvc-mini-profiler and also as a NuGet package. You should be able to use it to profile your site and perhaps spot any bottle-necks.
Another useful profiling-type tool is called Glimpse:
"At its core Glimpse allows you to
debug your web site or web service
right in the browser. Glimpse allows
you to "Glimpse" into what's going on
in your web server. In other words
what Firebug is to debugging your
client side code, Glimpse is to
debugging your server within the
client."

Related

ASP.NET MVC website performance issue on Azure AppServices

We have a ASP.NET MVC5 website hosted on Azure AppServices.
We have 2 distinct instances of this site on Azure: 1 for tests and 1 for production.
This 2 instances are in distinct Azure plans, but all services considered in each instance is in the same region (Western Europe).
The first one seems to work in an acceptable manner, but we are facing performance issues loading some pages on the 2nd one (sometimes from 15s to +30s page load times).
Each of our application instance is composed of:
ASP.NET MVC 5 (with FormsAuthentication)
N-Tiers Architecture
EntityFramework 6.1.3
ApplicationInsights service
2 SqlServer Databases (1 for business data & 1 for security data) located in a Azure Sql Service
The Azure plan used is "Basic (Small)" for AppServices, and "S0 Standard (10 DTUs)" for SqlServices.
The 1st one is running around 5% for CPU and 58% for Memory. The 2nd one is running around 3% for DTU.
With AppInsights, I've seen that "all is ok in controller" and the problem might comes from below.
I've also detected some page loads having the issue presents a failed Sql dependency call (with result code 207).
The Sql requests respond times are also separately ok (under 300ms).
We have, of course, already read a lot of posts about Azure performance issues but nothing that has helped us.
We would really appreciate some help please.
Many thanks!
Enable the profiler in Application Insights (same thing that used to live under https://azureserviceprofiler.com). It's now under the Performance blade.
Stress test your application for a few hours, enough for a good amount of ETL traces to be collected so it can paint a comprehensive picture of where time is being spent. A tiny "trace" icon will then become available next to your controllers:
Results look like this:

Can you trust the New Relic "Page average load time"?

Using: rails 3.2.11 and New Relic (free version).
I have had some problems with an app being quite slow. I have examined it and speeded up my app quite a lot. According to New Relic the app is still very slow, especially in the rendering phase. See pic:
According to Pingdom however, it seems to be loading in the matter of 2-4 seconds which is my experience when I visit the website as well.
I am using Memcachier and this speeds up the pages a lot but maybe New Relic always counts for un-cached controller runs?
My big question is, can you trust the New Relic "Average page load time" as a key to how slow your website really is? Would you trust the results of Pingdom more?
New Relic measures browser experience of real-world users from all over the globe with various connection speeds, browsers, and computers. As Jesse mentioned, comparing RUM with Pingdom isn't an apples to apples comparison. It's also unlikely that real-world experience on your website will match your experience and that's why RUM is so useful.
There are many ways to test the performance of a web page including webpagetest.org and YSlow. These tools might give you some more information about why your page is taking longer to load than you expect.
With access to the full suite of New Relic tools, you can access a geographic breakdown of page load time as described here: https://newrelic.com/docs/mobile-apps/geography-dashboard where you might discover that connections from a certain location are skewing your results unexpectedly. You can also access the browsers breakdown as described here: https://newrelic.com/docs/site/browsers where you might find that one particular browser is exceptionally slow for your page. If it's related to a browser, that's something you can certainly address. If it's just geography, you can rest easily knowing there's not much you can do beside perhaps a CDN which addresses connectivity issues in that location.
On the web transactions tab, you can see the browser performance by transaction even with a free subscription and that might help you see that one page is much slower than you realized and give you a target for optimization.
I feel like it's pretty accurate. What it does is inject some JavaScript in the footer of your page, and measures the difference between the time of the event like clicking links and submitting forms, and the page ready event. See here for more information: https://newrelic.com/docs/features/how-does-real-user-monitoring-work

ASP.Net MVC Website.. extremely slow after publishing

Hi
I've been working on a medium sized MVC project. It works fine on the localhost at a good speed rate. In each page, there's a lot of server-side data retrieved, I use a lot of jquery to minimize the traffic to the server, but even then, the webpage loads very slowly. There are many events on which I retrieve json results, to get a specific number from the database and make calculations, this data takes a long time to be retrieved on the webpage, although on the localhost it is immediately shown. Also, when I submit pages, it takes awfully a lot of time to submit. I've published my project to GoDaddy's server and also my database is there. What could be the problem that is making the project that slow? How can I minimize it? And why is it only when the website is online and not on the localhost too?
As such, issue can be anywhere and only certain way to know is instrumenting the code. I will suggest that you add simple logging traces with date-time stamp in your server code (note that logging should be configurable, any logging framework (including System.Diagnostic.Trace) should support it) and check where the time is spent. For example, database trips can be expensive etc. If you don't find the culprit on server side code i.e. sever is serving the request in reasonable time then you have to look at the performance over network. Tools such as Fiddler (or Firefox) should help you here - sometimes issuing too many requests from browser is also problematic because browser may make only n concurrent requests or even server may have been configured to accept only n requests from particular client - this could result in serialization of request increasing total response time. These scenarios are difficult to catch on localhost because network latency is almost zero there. You may also use tool such as YSlow for related performance improvement suggestions. But please do your investigation first, find the bottlenecks and then ask for solutions to specific problems.
Run it in chrome. Turn on the developer tools. Expand the Console. watch for errors. Also from there you can monitor those network calls to see which is slow.
if MVC uses entity framework (based on LINQ), it will sure be slow
because LINQ is slow compared to the old ADO.NET

How to increase the performance on my ASP.NET MVC 2 website?

I run a social community site for card players. I currently have 7,000+ members and getting 2,000 visitors/15k+ pageviews a day. Recently the site has started to really slow down during peak hours of the day and I am starting to think my site needs some serious performance optimizations in the code and settings. I really don't want to purchase a second server to run the site as I am pretty sure my current server should be able to handle this kind of load easily.
During peak hours, when the pages load, they still load very quickly. The problem is that a lot of times it will timeout and give a "website not available" error in the browser. Then you refresh it and it loads up quickly. Then a couple of pageviews later it will do it again. My CPU and RAM usage do not even get very high during these times, so I must believe it is in my IIS settings or something. I have done some searching and cannot find any good answers or ideas of what a fix could be.
Here are some stats of my setup:
ASP.NET MVC 2 w/ Output Caching and Partial View caching
IIS 7
Windows Web Server 2008 RC2 64-Bit
AMD Athlon II X2
4GB of RAM
My heavier pages on the site have quite a bit of database reads and a lot of image requests. I am not sure if this is the problem, because when a page does load it is VERY fast.
I did purchase a new server I am building and was thinking about switching everything to this instead. The new server I just got is gonna run an Intel Xeon X3430 2.4GHz Quad-Core w/ HT and 8GB RAM.
I am looking for a few possible things I could look into for this problem and if there are any possible solutions or settings I could implement to stop the "website not available" messages and also help my server handle future traffic increases as the site grows. Would upgrading the server to this new one make the difference?
It looks like this is more of an IIS issue than your code or hardware. There is a default setting for max concurrent connections per cpu and queue length that you may be reaching.
See Optimising IIS Performance and someone with a similar problem (and resolution).

Web App Performance Problem

I have a website that is hanging every 5 or 10 requests. When it works, it works fast, but if you leave the browser sit for a couple minutes and then click a link, it just hangs without responding. The user has to push refresh a few times in the browser and then it runs fast again.
I'm running .NET 3.5, ASP.NET MVC 1.0 on IIS 7.0 (Windows Server 2008). The web app connects to a SQLServer 2005 DB that is running locally on the same instance. The DB has about 300 Megs of RAM and the rest is free for web requests I presume.
It's hosted on GoGrid's cloud servers, and this instance has 1GB of RAM and 1 Core. I realize that's not much, but currently I'm the only one using the site, and I still receive these hangs.
I know it's a difficult thing to troubleshoot, but I was hoping that someone could point me in the right direction as to possible IIS configuration problems, or what the "rough" average hardware requirements would be using these technologies per 1000 users, etc. Maybe for a webserver the minimum I should have is 2 cores so that if it's busy you still get a response. Or maybe the slashdot people are right and I'm an idiot for using Windows period, lol. In my experience though, it's usually MY algorithm/configuration error and not the underlying technology's fault.
Any insights are appreciated.
What diagnistics are available to you? Can you tell what happens when the user first hits the button? Does your application see that request, and then take ages to process it, or is there a delay and then your app gets going and works as quickly as ever? Or does that first request just get lost completely?
My guess is that there's some kind of paging going on, I beleive that Windows tends to have a habit of putting non-recently used apps out of the way and then paging them back in. Is that happening to your app, or the DB, or both?
As an experiment - what happens if you have a sneekly little "howAreYou" page in your app. Does the tiniest possible amount of work, such as getting a use count from the db and displaying it. Have a little monitor client hit that page every minute or so. Measure Performance over time. Spikes? Consistency? Does the very presence of activity maintain your applicaition's presence and prevent paging?
Another idea: do you rely on any caching? Do you have any kind of aging on that cache?
Your application pool may be shutting down because of inactivity. There is an Idle Time-out setting per pool, in minutes (it's under the pool's Advanced Settings - Process Model). It will take some time for the application to start again once it shuts down.
Of course, it might just be the virtualization like others suggested, but this is worth a shot.
Is the site getting significant traffic? If so I'd look for poorly-optimized queries or queries that are being looped.
Your configuration sounds fine assuming your overall traffic is relatively low.
To many data base connections without being release?
Connecting some service/component that is causing timeout?
Bad resource release?
Network traffic?
Looping queries or in code logic?

Resources