IIS 7 app pool optimization - asp.net

I have several sites running on win 2008 64bit/ IIS 7 with each sites go with a separate application pool (default settings).
The problem is that many of them, very simple and low traffic site, consume lots of memory(100mb - over 1 gb). Most of them are written in c# asp.net 4.0 managed code (linq to sql and entity framework 4-5.0).
say one app pool is at 90000 kb, if i run the web on browser, it could go up to more than 200000 kb. Is it normal ?
So what would i do to keep them cool down without interrupting (much*) the performance ?
Should i lower the default recyling interval ?
Also, anyone know the best solution to monitor/trace memory leak that's easy to use.

Related

.NET Core Website consumes a lot of memory

I have a website that is built on top of ASP.NET .NET Core 2.0 and it worked for 8 months without any issues but 2 days ago i got a message from the host provider that my website is consuming 33GB of RAM which made them suspend my account so i asked them to limit my resources according to my Plan which is only 2GB physical and 4GB Virtual, and that made my website pool stops about 6 or more times per day and i have to restart it manually to get the website back,
i have tested they website using Resharper DotMemory Tool and the Visual Studio
Diagnostic Tools (which i'm new for such operation), and i see that the website start with about 300MB of RAM and it keeps raising while using the website, but its top is 1.1GB RAM as here (
Screenshot)
so i'm not sure what should be the solution as the host provider tells me to upgrade to VPS or optimize my website(that i haven't made any Coding changes for about 3 months (Only Data Entry))

Find memory leak in ASP.NET Web App

I'm hosting 7 websites on a single production server (virtual) at 2.53 Ghz (2 CPU) and 8GB of RAM on WIN SERVER 2008 R2 Enterprise 64 Bit.
Web server is IIS 7 and all of the websites are with .NET Framework 4.0 application pool.
My current memory usage is about 4.16 GB out of 8GB and w3wp.exe is the most process which consuming most of the memory usage (about 1.6 GB at this time) followed by sqlservr.exe with (1.5 GB) usage.
What I would like to do is to know which website out of 7 is consuming the most memory so that I could have a look.
I've tried Process Explorer and Resource monitor but it could only show how much rem taken by w3wp.exe but not individual website's usage.
Is there a way where I could pin point the memory hogger?
You could do a memory dump using Microsoft's Debug Diag tool.
Basic process is:
Launch DebugDiag
Cancel Wizard
Click "Processes" tab
Select w3wp
Right-click and select "Create full dump"
Snigger quietly to yourself because you said "dump"
Once dump is complete (snigger again), click "Advanced Analysis" tab
Use the 2 Memory Pressure Analyser scripts to see if you can see what objects are using a lot of memory.
I would advise doing this in combination with Uri May's answer, as otherwise you will likely waste a lot of time.
You can configure each web site to use different app pool, that way you'll have a w3wp.exe process for every web site of the 7 websites you host. After that you can use the tool in the following this link to find out which of the websites is causing the leak by tracing the PID of the w3wp.exe with biggest memory consumption.
In windows task manager you can see which app pool is running each w3wp.exe simply by showing the "user" column. This is because each app pool typically runs with its own user. They made it a bit harder to see this in Windows 2012 server - you need to click on "details" tab first.

First request is very slow after website sits idle with ASP.NET MVC 3 (IIS7)

I developed a project in ASP.Net MVC 3, my hosting is using iis7 (Win Web Serv 2008 R2), and the first request after the website sit's idle (during about 1-2 hours) is very slow.
I use VPS with 512Mb RAM. Can this be related with a too little RAM?
Can anyone help me with possible causes of such behaviour?
After a certain amount of inactivity IIS unloads the AppDomain. And then the first request loads the application once again which is slower. You could try to configure this period in the properties of IIS but there might also be other causes that an application unloads such as for example a certain threshold of CPU or memory usage is reached. Those thresholds are also configurable in IIS.
That's not something specific for ASP.NET MVC. It's true for all ASP.NET applications in general.
We had also this problem with ruby and passenger that takes the app out of memory after a while, but I found a nice application that fixed this issue for us without changing anything in the server configuration, the app is called wekkars, and you can find it here: http://www.wekkars.com

IIS 6/7 Slows down ultimately while trying to access ASP.net 4 page from non-localhost computers

When I deploy my ASP.net 4 website on newly installed IIS 6 on Win Server 2003 R2 or on IIS 7 on Windows 2008 R2, I have a very good (actually instant) access to my website pages while calling them locally, but while trying to access them from any other intranet computer, the speed slows down very badly and I can not find what is the problem. It has been become a major problem for me and my job and I've been looking for a solution but I've not detected any solutions already. Would you please helping me?
By the way the users of this website will be at max 20 persons and I've deployed my app on a very very powerful dedicated server with about 64GB of RAM and 16 CPU cores.
Thank you so much.
This could be created by many different things such as:
Incorrect IIS configuration
Incorrect Routing
Database Latency
Server Over utilization
I would start by seeing if a static HTML page with no code is delivered quickly. If yes then I would look at using ASP.NET Tracing as a starting point to see where the problem in the code may be. If No then I would look at the IIS and routing configuration for your network.
I changed to forms authentication and I am getting very good speed results.

How to track IIS server performance

I have a reoccurring issue where a customer calls up and complains that the web site is too slow. Specifically, if they are inactive for a short period of time, then go back to the site, there will be a minute-two minute delay before the user sees a response. (the standard browser is Firefox in this case)
I have Perfmon up and running, the cpu utilization is usually below 20% (single proc...don't ask). The database is humming along. And I'm pulling my hair out.
So, what metrics/tools do you find useful when evaluating IIS performance?
Hope this helps:
Best Practices for Speeding Up Your Web Site
Scaling Strategies for ASP.NET Applications
IIS Tuning
14 Rules for Faster-Loading Web Sites
Best practices for creating websites in IIS 6.0
Stanford Computer Cience - High Performance Web Sites
10 Tips for Writing High-Performance Web Applications
Writing High-Performance Managed Applications : A Primer
Nine tips for a healthy "in production" ASP.NET application
Speedy C#, Part 2: Optimizing Memory Allocations - Pooling and Reusing Objects
Memory Usage Auditing For .NET Applications
Troubleshooting HTTP Compression in IIS 6.0
Maximizing IIS Performance - 25 tips
Optimizing IIS 6.0 Performance
Page Speed - an open-source Firefox/Firebug Add-on
Performance Testing Guidance for Web Applications
Top 10 Performance Improvements in IIS 7.0
CHAPTER 6 Optimizing IIS 6.0 Performance
Performance Tuning Guidelines for Windows Server 2003 - Performance Tuning for IIS 6.0
ASP.NET Performance Tips
IIS 6.0 Tuning for Performance - by Peter A. Bromberg, Ph.D.
Improving .NET Application Performance and Scalability - by MS
Optimizing and Performance Tuning IIS 6.0
12 Steps To Faster Web Pages With Visual Round Trip Analyzer
Thread: IIS 6 performance tweak guide (draft)
CPU Settings for an Application Pool IIS6 e IIS7
Great improvements tips :
Running ASMX Web Services on STA Threads
Scale Net
Measure, measure, measure :
Load Test Your Site
Show Slow
Performance Monitor Wizard
Two Minute Drill: Introduction to XPerf
Suggested Performance Counters to Watch (IIS 6.0)
See what the best sites did :
Benchmarks
TOP 100
More resource :
Learn papers
My experience says:
Enable compression (GZIP/Deflate) in IIS, for Static data. Simple to implement and with excellent results.
if cpu is not your problem try to enable compression for dynamic data as well.
For your particular case, you need to increase the idle-timeout option in IIS because that delay is due to ASP.NET loading the binaries and starting your application. The default is 20 minutes, so if nobody accesses the site for 20 minutes, IIS will shut down the process and the next request will take a long time to start up.
Maybe the application pool is shutting down when there is a period of inactivity? The application pool would take some time to start back up.

Resources