Asked by:
high memory usage in iis10?

Question
-
User-1801350238 posted
I use iis to publish a same asp net web form app on windows 2016 and windows 2012 using the same config. Using the jmeter to visit the same request, in windows 2016, w3wp consume so much memory than windows 2012, the result are as follows:
windows 2016:
get-process w3wp
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
1353 2696 3759952 3366428 121.66 578740 323 w3wpwindows 2012:
get-process w3wp
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
633 612 298820 108760 1458 117.45 4700 w3wpFriday, June 16, 2017 10:15 AM
All replies
-
User690216013 posted
Do you use System.Drawing or any other client only namespaces in this app? The recent .NET Framework upgrade does introduce more memory usage to achieve better rendering effect for WinForms and WPF. Never use such namespaces in a web app, as that's already bad practice known for years.
Anyway, you should use a profiler to better analyze the memory usage so as to gain more insights.
Friday, June 16, 2017 1:46 PM -
User-1801350238 posted
Thank you for you reply. For the web form app, I just write an hello-world web form app, you can see the code in this link: https://github.com/shiyan2016/webforms.
You can use the code directly publish an website in iis manager.
Saturday, June 17, 2017 2:04 AM -
User-1801350238 posted
And my original intention is to test the memory usage of the same web site on windows 2012 and windows container because we want to migrate the website from 2012 vm to windows container. Then I found the high memory usage for windows container, so I also test the app on the container host(windows server 2016) to exclude the effect of container. Base the windows 2016 physical machine also use higher memory, so I think the effect is iis10. My intention is not to analyze the app, for app effect, I also test another app, the result is almost the same.
Saturday, June 17, 2017 2:15 AM -
User-2064283741 posted
Can you check the raw IIS logs to see if the requests match up?
e.g. if there are say 1000 in a minute on 1 servers they are on the other.
It could be that more requests are being processed.Saturday, June 17, 2017 6:29 AM -
User-1801350238 posted
I use jmeter to send 50000 request to the same page, the result are as follows:
On windows 2016, it tasks 10m41s and the throughtout is:78.0/sec, received kb/s is: 235.84. sent kb/s is: 13.71.
w3wp process info:
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
2078 2708 3827960 3431776 199.19 527916 323 w3wpOn windows 2012, it tasks 10m33s and the throughtout is:79.1/sec, received kb/s is: 238.6. sent kb/s is: 13.82.
w3wp process info:
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
700 627 302536 112624 1459 137.39 31080 w3wpSaturday, June 17, 2017 7:37 AM -
User-2064283741 posted
Well that explains it.
You are processing nearly 5 times the requests.
325 requests a second. That is significant for 1 box.
If you are expecting that sort of traffic (which is sort of the point of a load test) you need to look at other solutions. Create a web farm (you will probably need many boxes for that sort of traffic), etc.
If you want to like for like test use the 77 requests a second throughput.
It makes total sense if you have crazy traffic that the CPU will slow down.
If the 77 requests a second is what you are using a baseline and you are migrating you need to match that.
Compare the CPU on the windows 2012 and windows 2016 machine with the same metrics.
You are asking the wrong question about how can slow the process request down. That question is more complex and what do you wnat to do queue up more requests? Reject them outright? Or (most common) try and let the machine as many requests as possible as quickly as possible...and that is what is being done at the moment.
Saturday, June 17, 2017 8:29 AM -
User-1801350238 posted
The previous test result is not correct because the 2016 and 2012 are in different network environment. I have update the test result using the same network environment machine, pls have a look.
Saturday, June 17, 2017 8:58 AM -
User-1801350238 posted
I found that with the increase of the cpu count for windows 2016, requesting the same count of the web page, the memory usage will also increase. So is there any config to disable this feature?
Monday, June 19, 2017 9:39 AM -
User-2064283741 posted
Not sure why you are experiencing a difference performance with 2016. Memory and CPU issues can be difficult to work out and although you say you have the same code often it is the code that causes these issues.
Maybe there could be something in IIS effecting this so I first would look at making sure you have the same setup of of IIS on your 2012 ans 2016 machines. I would use web deploy to make sure you have all the setting copied, not just the site setting but all the IIS config as you could be inheriting config setting for the site from the server.
Other than that you will need to do some deeper investigation to discover what is ahppening, often these can be complex. Analysis memory dumps, etc.
Maybe online tools like Lean Sentry can help you diagnose what is going on.
Monday, June 19, 2017 11:04 PM