.NET Core Website consumes a lot of memory - asp.net

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))

Related

Embedding Quartz into ASP.NET application with always run

I had an on-going enterprise development which involved Quartz to do daily/weekly jobs such as
Clean up temporary folder
Send Emails
Update databases
Publish items
and I'm embedding Quartz into an ASP.NET application with always run, no idle timeout, & recycles app pool every day at 4am, & it works perfectly.
I've been searching on Stackoverflow & many people suggested to make it a Windows service, however those answers were a few years old - before IIS 8 became available.
I wonder if my implementations has some cons & will cause side effects that yet to be known? Only 1 ASP.NET application to be run in this machine.

Trouble with IIS6 ASP application hanging

I've been meaning to get on here for ages, alas, my recent problem is motivating me, hoping to contribute and not just sponge, but hopefully someone can assist with this issue.
We have two 2003 web servers (looking to upgrade) running IIS6 running multiple ASP.net applications on one web site (via Microsoft NLB).
We have a persistent issue with one application, that is, the white screen of death, the application just hangs, no errors.
Things I have tried / observed:
Taken servers out of NLB
Checked HTTPERR for errors at time of issue, some bad requests and connection abandoned by app pool present
IIS logs show requests coming in
Checked database for locking PID's or performance, everything ok
Checked network connections and links to other API's all good
Checked other websites on server - not working ok
Event app logs no errors found at exact time of issue
Split out app pools, found the problem application
IIS reset and shutting down all IIS process and services gets it working again
So next when application hung, recycling that specific app pool gets it working for a short period
'SOME' parts of the same application will work, even though the main function hangs and gives the white screen of death
Other things to note:
Server has 4GB ram, terrible I know, 4gb page file, 1.7gb total in use
CPU usage always <12%
Resources not 'really' a major factor
Only one w3wp for this app pool (been running like this for years)
After setting the app pool to recycle on an hourly basis and tweaking some app pool settings, the issue seemed to go away for at least six months. Now it's back for whatever reason, no updates, no changes in application or infrastructure.
I've upped the worker process for the app pool to 2, the issue still persists after a period of time
I observed THREE worker process at random intervals when checking not the TWO set up, could be part of the recycle process (one starts up, other shuts down) and I caught it at that moment.
Killing the highest RAM usage W3WP re-instates application instantly when new process starts up for that app
Common RAM usage when site failing appears to be apprx 210mb on one of the applications W3WP
I have now set recycling rules instead of hourly to recycle at a more purposeful 200mb. Why this would be a limiting factor I do not know.
I'm struggling to get to the bottom of it, but it doesn't appear to be network, hardware, NLB, Database, or any other core factors. It is specific to a worker process for this app pool hanging / crashing and not processing requests for a certain part of the site.
I am running an effort to upgrade to 2008 in the next few months (version of ESX does not support 2012 and that upgrade is not in scope). However, I'd really like to work out what the issue is rather than using web deploy to deploy a dodgy installation of a legacy application.
Any advice or help appreciated.

IIS 7 app pool optimization

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.

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.

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.

Resources