I have a website in IIS 7 and I need to monitor the memory usage of that website when there are concurrent requests for it. Can you please let me know how can i do this? Is there any tool available or is that possible to use any feature of IIS?
Windows Performance Monitor should be able to get you pretty close to what you want. There are literally hundreds of metrics in there to use.
To access it, simply do Start -> Run -> perfmon
From there, select 'Performance Monitor' in the left pane, and click the '+' button to begin adding in counters.
If its an ASP.NET based web site, you can select one of the 'ASP.NET Apps' counter categories (may have more than 1 if you have more than 1 version of ASP.NET installed) and click on the 'Managed Memory Used' counter. In the list below that, all actibe websites are displayed and you can add the counter for that. You can watch the counter in realtime or elect to save the data to disk or a DB for later analysis.
There is a W3SVC_W3WP counter category that allows you to examine metrics for specific app pools but nothing (that I can see) that will offer memory used per app pool.
Depending on what you are trying to determine though, you may be able to find a bunch of metrics to aid in your analysis.
To get the 'Managed Memory Used' counter to work on my server I found I had to make an additional change:
The aspnet.config config file (generally located at C:\Windows\Microsoft.NET\Framework\v4.0.30319, YMMV) needs to be modified to include the appDomainResourceMonitoring element (although there will probably be other stuff there as well):
<configuration>
<runtime>
<appDomainResourceMonitoring enabled="true"/>
</runtime>
</configuration>
There is no need to restart IIS, but you do need to recycle application pool you want to monitor.
See these two blog posts for more info:
Performance Monitoring of individual Asp.net Application in Asp.net 4.0
Asp.Net 4.0: An Overview-Part-III
Related
I need to run 4 background gobs for cleaning temp files and proccessing some files. I have chosen Quart.net for the job.
I have a Asp.Net website, which accepts uploading files that will be processed by the Quartz Jobs at night.
First i thought about making a console application for the Quartz jobs, keeping the website and the jobs totally decoupled.
But then, i've seen that i will need some config values (connectionstring and paths to files) that are on the asp.net web.config. So a question came to my mind:
Should i run the jobs through the asp.net instance or should i do this on a console application?
Furthermore, i want that when the Quartz jobs start running, the website show a special page (like "We are processing the files...).
What i care the most is the performance, i don't want the website to be affected by the Quartz jobs, neither the jobs' performance affected by the website.
So, what should i do? Have you done something like this and can give me an advice?
Should i run the jobs through the asp.net instance or should i do this on a console application?
If you want to have to manually trigger them each night, sure. But a console application using the host system's task scheduler seems like a more automated solution. A web application is more of a request/response system, it's not really suited for periodic or long-running actions. Scheduling some sort of background operation on the host, such as a scheduled console application or a windows service, would serve that purpose better.
Note that if it truly needs to be unattended and run even when there's nobody logged in to the server console, a windows service may be a more ideal approach than a console application.
i've seen that i will need some config values (connectionstring and paths to files) that are on the asp.net web.config
Console application have App.config files which serve the same purpose. You can use that.
i want that when the Quartz jobs start running, the website show a special page
You definitely want to keep the two de-coupled. But you may be able to accomplish this easily enough. Maybe have some sort of status flag in the database which indicates if any particular record is "currently being processed". The website can simply look for any records with that flag when a page loads and display that message.
There are likely a couple of different ways to synchronize status here, it doesn't really matter what you choose. What does matter is that the systems remain decoupled and that any status which is statically persisted is handled somewhat carefully to avoid an errant process from leaving an incorrect status. (For example, a background task sets a status of "processing" and then fails in some way. The website would forever indicate that it's processing.)
I have an ASP.Net MVC 4 application hosted on Windows Server 2008. I'm using Microsoft Application Insights, and it's working perfectly for client side metrics such as Client Processing Time, Custom Events, Users, Sessions, Page Views, etc. However, I cannot get any server-side metrics such as Processor Time or Available Memory. The areas are all covered by a banner that says something to the effect of "Learn how to collect server request data". When I click on the banner, it shows a blade with instructions, all of which I've already completed (the quick start).
In addition to installing the Application Insights SDK through VS 2013 (0.12.0-build17386), I've also installed and configured the Application Insights Status Monitor on the server. I've restarted IIS, and even restarted the server. Despite all this, I cannot get any server metrics. I've read the troubleshooting guide, and I've checked everything mentioned therein such as making sure the app pool identity is part of the "Performance Monitor Users" group.
I feel as though there is something I have to do to the ApplicationInsights.config file in order to either turn on and / or define the server metrics I want, but I simply cannot find any documentation on this.
Any help or suggestions would be greatly appreciated. Thanks!
No you shouldn't do anything additional with ApplicationInsights.config. Performance counters are the part of default monitoring package and almost all problems are related to that user is not the part of 'Performance Monitor Users' group, but it's not your case.
To be sure that config is correct you can check that the following module is defined in ApplicationInsights.config:
<Add Type="Microsoft.ApplicationInsights.Extensibility.PerfCollector.PerformanceCollectorModule, Microsoft.ApplicationInsights.Extensibility.PerfCollector"/>
Also do you see any notifications in the StatusMonitor and/or traces/exceptions in the Diagnostic search at the application insights resource overview blade?
Ok, we've got it. There was an ApplicationInsights.config in the root folder of the application, and that was the only one I've ever looked at. At Yulia Safarova's suggestion, I discovered another one inside the bin folder. This one did NOT have the module definition specified. (It was basically empty). I copied all the contents of the one from the root into the one in the bin folder, and all the data started to flow.
If you are looking for the server data like CPU, Memory, Response rate to be displayed on the Azure Application Insight, then along with the addition of above module, also make sure that the web application Identity user is part of the administrator group on the server. and below flag is turned on in web.config
"EnableAppInsightUsageCollection" value="true"
Problem description:
On our website we use standard asp cache with duration set to 5h.
It works fine, but sometimes the publisher add some special content that need to be showed impatiently on many different sub-pages (example some promoted article).
That's what I need to do it's easy to use page like this:
mydomain.com/admin/clear-all-website-output-cache.aspx.
I want to clear SERVER SIDE CACHE.
Thanks for help.
we use: IIS7, ASP.net 3.5
See this ServerFault question: Will an IIS reset force cached items to be resent?
This says that you need to use IISRESET (or reset IIS any other way) to do it.
I assume recycling the application pool of the application will have the same effect. It's a good practice to have one application pool per application, so, this should be less problematic than resetting IIS if there are other critical applications.
If your app pool is shared with other applications, create a new one, and change the app pool in the application properties to the new pool. Likely will have a similar effect.
BTW, I do not think stopping and starting the website (assuming likely the app has its own website) will have a similar effect, as it will not stop the process instance that holds the cache, which is represented by app pool. Not 100% sure though.
Use cache dependency on some file, the cache will expire when the file changed.
As Maurico and codeka first stated, don't use the default InProc sessions if you don't want your sessions to be affected by website recompiles and application recycles.
A list of what causes whole website recompile:
By default, when any change is made to a top-level file in a Web site, the whole site is recompiled. Top-level files include the global.asax file and all files in the bin/ and App_Code/ folders.
modifying web.config
a configuration include file change, if the SectionInformation.RestartOnExternalChanges property is true
<section
name="MyAppSettings"
type="System.Configuration.AppSettingsSection, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
restartOnExternalChanges="true"
requirePermission="false" />
Notes:
If you want to be able to change top-level files without causing the whole site to be recompiled, you can set the optimizeCompilations attribute of the compilation element in the Web.config file to true
References:
Understanding ASP.NET Dynamic Compilation
Where's the info that tells the kinds of changes and files which cause a website project (not web application project) to recompile itself?
The reason I'm asking is because we don't want users to lose their sessions. Therefore we want to update the live website with recompilable changes only in the very wee hours of the morning, but would prefer to make changes during the day to expedite them. We do promote to a staging server first and watch it there, but a definitive list would be nice in advance.
You'll lose sessions not just when your website is recompiled, but also when the IIS worker process is recycled. Technically, that can happen at any time (there are ways to minimise it, but I prefer to architect applications that can survive worker process recycles anyway), so if sessions are important then you really do need to be storing them out-of-process.
ASP.NET comes with a built-in "state server" which is just a windows service that stores session state. Another option is to use the SQL Server session state storage.
A lot of people will tell you that storing session state in SQL Server is a performance problem, but I disagree: losing sessions due to process recycles is more of a concern than the performance of SQL Server. Besidess the ASP.NET state server is faster if that's what you really need (and if you want to survive power cycles you could even write a custom provider that stores state in a NoSQL database!)
Is there a way to profile IIS7? (freeware?)
Number of connections
Bandwidth usage
Errors (Event Viewer?)
-...
thx, Lieven Cardoen
ps: Something similar to mssqlserver profiling
There's nothing quite like MSSQL's profiler, but a set of tools:
Perfmon will show you the # of current connections per website. Perfmon.msc, web service, current connections, select website, click add. Don't like the interactive nature of perfmon? No problem, use logman.exe, a nice CLI for perfmon.
Bandwidth usage you can get from your log files if you enable bytes sent & bytes received in your iis log files. This is also available via performance counters - web service, bytes sent/received/sec. I think the two complement each other fairly well.
IIS7 has a new feature called Failed Request Tracing. You can tell it to log on all 500's,or any .aspx page that takes 15 seconds to run, or based on event severity. It saves all of this information in an XML file for you under \inetpub so it's easily parseable, and also gives you a nice XSLT to view it in your browser and drill down if you like.
http://learn.iis.net/page.aspx/266/troubleshooting-failed-requests-using-tracing-in-iis7/
Try out the Administration Pack for IIS 7.0. It has:
Configuration Editor:
The configuration editor module will help you manage your configuration files. This tool is available for server administrators only. It allows you to edit any section, attribute, element or collection in your configuration file. In addition to editing these values you are also able to lock and unlock them. The configuration editor also allows you to generate scripts based on the actions you take as well as search the file to see where values are being used.
IIS Reports:
The IIS Reports module enables you to view key statistics about your website. You can also generate your own module reports to gather information relevant to you and your business. Currently you can view the output of these reports as charts and/or tables.
Database Manager:
This module is no longer part of the Administration Pack and instead is offered as a separate download in the IIS Download Center.
UI Extensions:
UI Extension modules allow you to manage existing features through IIS Manager.
The FastCGI module allows you to manage your FastCGI settings.
The two ASP.NET modules allow you to manage your authorization and custom errors settings.
Finally the HTTP Request Filtering allows you to setup rules for http request filtering.