IIS And Ajax UpdatePanel Results In Extreme Memory Usage?
Nov 26, 2010
I have a update panel combined with gridview with sorting and paging.
I go into task manager to monitor the memory usage of the worker process (w3wp)
What I do is just click on the sort buttons rapidly.
With each click the memory of the process increases with about 2 mb
So I go from 30 mb memory usage to about 90. Then it stops at remains there, no memory is freed up. I am not using caching or session/application state.
What can be causing this, is there a setting in IIS to reduce the mem usage?
I also used .net profiler to examine my app memory usage: 4 mb, so what is the other 86 used for??? Even though it repots 4mb, in task manager it says 90 mb, so this leads me to believe that the rest is namanaged memory which must be used by IIS in some way.
I have an ASP.NET 3.5 app that collects data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.
There is no database access, no session storage, but an in-memory list of about 100 objects/1MB of data, plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.
The issue:
When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.
When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.
Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.
I created a site which fills an UpdatePanel with dynamically created buttons when clicking on an other button. Now every time I click the button the used memory increases. I already tried the workaround from http://www.crockford.com/javascript/memory/leak.html to remove old eventhandlers before updating the UpdatePanel. But the used memory still increase. Is there a problem with my code or is there an other workaround?
Here is the code of a sample aspx site which shows the problem: [Code]....
After researching why a page I have using an UpdatePanel to perform a refresh every 15 seconds was using up piles and piles of memory over time, I discovered that this is a "well-known" issue with the UpdatePanel not cleaning up properly in IE (some issue with reference counting in COM interop or some such). UpdatePanel does not seem to have this issue in Firefox (haven't confirmed the issue in other browsers).If this is a "well-known" issue, two questions:Is there a "well-known" workaround to this? I know that a full-page refresh will cause the memory to be cleaned up, but some pages may be up for a long time and I don't want to interrupt any user interaction with the page that may be going on. I will if it is required, but it is a sloppy, sloppy UI kluge... you know, one of those "as a self-respecting coder I hang my head in shame at what I have wrought" kind of kluges.Is there any effort being made to fix this? I've looked about, however, most articles on this do not make mention of even MS acknowledging bug status for this while I've seen many telling me why this is an issue, and how it's a "design" thing. I hear IE9 is supposed to take care of this... I guess what you'd call a non-issue, but it will only be available to Windows 7 users.
I have really tried to Google it but only articles about how to troubleshoot memory issues come up. Before I start to troubleshoot, I would like to know if my web site's memory usage is really abnormal or not.
So it is an asp.net mvc 2 website that runs on IIS 7.5 in production. I guess normal memory usage depends upon traffic, so here are the numbers of an average day:
300 unique visitor 400 visits 3000 page views
I would be really happy to get some idea how much is the normal memory usage for this traffic. Also I would be curious to know how memory usage normally increases with traffic growth.
I have an ASP.NET app that scrapes data from a handful of external pages, parses the relevant bits and displays them in a table. Total data retrieved is 3-4MB and the resulting page is about 1MB. I am using synchronous WebRequest GetResponse for the retrieval, but the same problem existed using an asynchronous BeginGetResponse/EndGetResponse process.There is no database access, no session storage, no caching, but an in-memory list of about 100 objects (total 1MB of data), plus a good amount of AJAX (AjaxControlToolkit). This issue appears on the very first run of the app, even if I have restarted IIS.
The issue:
When I run the app on my dev computer, the maximum commit charge is about 1.5GB. The biggest user, measured by Task Manager's VM Size, is WebDev.WebServer.exe (600MB). The app runs perfectly.
When I run it on my rent-a-server (IIS 7.5, 1GB RAM), the maximum commit charge is over 3.8GB. The biggest user is w3wp.exe at 2.7GB. IIS grinds to a halt and spits out a timed-out error page.
Given my limited server budget and the hope of having multiple simultaneous users, I'm kind of in a panic.
Is this normal? If I bump the server RAM up to 4GB, will that be enough?
On an ASP.net site at my place of work, the following chunk of code is responsible for handling file downloads (NOTE: Response.TransmitFile is not used here because the contents of the download are being streamed from a zip file):
[code]....
I've just read about the 'buffer' property of the Response object. If I set that to false, will that prevent the Response.BinaryWrite() calls from buffering the data in memory? In general, what is a good way to limit memory usage in this situation? Perhaps I should stream from the zip to a temporary file, then call Response.TransmitFile()?
EDIT: In addition to possible solutions, I'm very interested in explanations of the memory usage issue present in the code above. Why would this consume far more than 1MB, even though Response.Flush is called on every loop iteration? Is it just the unnecessary heap allocation that occurs on every loop iteration (and doesn't get GC'd right away), or is there something else at work?
I am hosting a solution with an outside company so getting them to troubleshoot or send me log files is not working.
Is there a way from code or Global.asax file that I can trap Memory usage from my web application when it reaches a certain amount? Then figure out what is using all the memory
I would like to use output caching with WCF Data Services and although there's nothing specifically built in to support caching, there is an OnStartProcessingRequest method that allows me to hook in and set the cacheability of the request using normal ASP.NET mechanisms.
But I am worried about the worker process getting recycled due to excessive memory consumption if large responses are cached. Is there a way to specify an upper limit for the ASP.NET output cache so that if this limit is exceeded, items in the cache will be discarded?
I've seen the caching configuration settings but I get the impression from the documentation that this is for explicit caching via the Cache object since there is a separate outputCacheSettings which has no memory-related attributes.
Here's a code snippet from Scott Hanselman's post that shows how I'm setting the cacheability of the request.
I'm using asp.net and chrome and the page becomes unresponsive after a while. When I look at the chrome debug, I see that memory usage increases to about 80MB and chrome popups a request to kill the page. The error counter spins and generates about 30,000 errors when the popup comes. What triggers the error is the call of an updatepanel. The error as displayed in chrome is "Failed to load resource".
The update panel: the user clicks on a button and the panel is refreshed. There's only one update panel on the page.
The errors compound on every postback: 1,4, 11, 26, 57, 120, 247.... eventually chrome kills the page. When I put a breakpoint in the function, it stops the code just after I press the button; then after it hits the __doPostBack line, it starts the GetNewDate function again several times by going back to the line of the click event, apparently executing it the number of times shown above.
Is there a way to get load information on Application Server? How much memory or CPU is being used at a given point? I want to either 1. Limit users to use specific functionality of ASP.NET 3.5 application or 2. Deny users from accessing the application saying "Server is busy at the moment"
Is there a way to check the memory usage (consumption) of individual controls on a web form shown in a browser. Like Repeater Control, Multiline Text box etc. The reason is I am putting the repeater control in session and checking the status of controls, based on which I am doing further actions.
I have a quite strange situation where I have the following code:
[Code]....
This gives a quite strange result: Every 5s my whole page gives a full postback. When I comment in (activate) the asyncpostbacktrigger, the updatepanel does not give a full postback. In the PlayerItems_ItemDataBound I have the following code (which, I do think, do not matter):
[Code]....
When I create a NEW updatepanel, ItemsUpdatePanel1, it does not fire a full postback without the timer. I can even start copying items from ItemsUpdatePanel to ItemsUpdatePanel1, and suddenly the full postbacks happen. I tried 2 seperate times, and they started happening at different times. I simply want the UpdatePanel NOT to give a full postback, even without a timer.
Environment.WorkingSet incorrectly reports the memory usage for a web site that runs on Windows 2003 Server.(OS Vers: Microsoft Windows NT 5.2.3790 Service Pack 2, .NET Vers: 2.0.50727.3607)
It reports memory as Working Set(Physical Mem.): 1952 MB (2047468061).
Same web site runs locally on Windows Vista with a Working Set(Physical Mem.): 49 MB (51924992).
I have limited access to the server and support is so limited.
so i have computed the total memory by traversing with VirtualQuery.
Total of pages with state: MEM_FREE is 1300 MB.
(I guess server have 4 GBs of RAM and PAE is not enabled, max user mode virtual address is 0x7fff0000.)
So, i know working set is not only about virtual memory. But, is it normal to have such a high working set while its very low on another machine?
I've been profiling my ASP.NET application with ANTS Memory Profiler 6, and have seen indications of memory leaks. However, I don't know whether or not the growths I'm seeing are supposed to be there or not (for instance, System.String grows a lot each snapshot. Should it?)I don't understand the whole memory processso I don't know if I am interpreting the results correctly or not. How do I interpret the results of the ANTS Memory Profiler?
I have a page that works great until now that they wanted to add a ModalPopup based on a field value. Before the addition of this modal popup, i had a button event that would do the inserting of the data, it caused the page to validate and as long as the page passed then it would insert and move on to the next page. Now i have a ModalPopup displaying IF a certain field is empty. If they answer Yes to the modalpopup question, it takes them back to the page and sets the focus on that field. Works fine, but if they select No then i need the page to validate and insert the record and move on.I have a customvalidator for the field i need to check. I then have my insert on the main button that causes the validation. The "Yes" and "No" buttons within the modalpopup have the following setup. [Code]....
My Main submit button has the following: [Code]....
If i select NO it just goes back to the page and doesnt move forward. If i select YES and enter something the page pops up the modal again and again because i've clicked in the field and keeps asking even though there is now a value in the field. But since there is a value, i can continue on to the next page.
This gives a quite strange result: Every 5s my whole page gives a full postback. When I comment in (activate) the asyncpostbacktrigger, the updatepanel does not give a full postback. In the PlayerItems_ItemDataBound I have the following code (which, I do think, do not matter):
protected void PlayerItems_ItemDataBound(object sender, ListViewItemEventArgs e) { if (e.Item.ItemType == ListViewItemType.DataItem) { ListViewDataItem dataItem = e.Item as ListViewDataItem; if (dataItem != null) { BaseItem myItem = dataItem.DataItem as BaseItem; Panel itemPanel = new Panel(); Literal firstLiteral = new Literal(); firstLiteral.Text += "<div id='smoothmenu1' class='ddsmoothmenu'>"; firstLiteral.Text += "<ul>"; firstLiteral.Text += "<li><img src='Images/Game/Items/" + myItem.ItemImageUrl + "' />"; firstLiteral.Text += "<ul>"; // Add all events bound to item into contextmenu itemPanel.Controls.Add(firstLiteral); foreach (Delegate del in myItem.Actions.Items) { Literal firstItLit = new Literal(); firstItLit.Text += "<li>"; itemPanel.Controls.Add(firstItLit); MethodInfo methodInfo = del.Method; string commandName = myItem.ItemId + "|" + methodInfo.Name; LinkButton btn = new LinkButton(); btn.Text = methodInfo.Name; btn.Click += new EventHandler(btn_Click); btn.CommandName = commandName; itemPanel.Controls.Add(btn); Literal secondItLit = new Literal(); secondItLit.Text += "</li>"; itemPanel.Controls.Add(secondItLit); } Literal btnLiteral = new Literal(); btnLiteral.Text += "</ul>"; btnLiteral.Text += "</li>"; btnLiteral.Text += "</ul>"; btnLiteral.Text += "</div>"; itemPanel.Controls.Add(btnLiteral); Panel panel = (Panel)(e.Item.FindControl("ItemPanel")); panel.Controls.Add(itemPanel); } } }
When I create a NEW updatepanel, ItemsUpdatePanel1, it does not fire a full postback without the timer. I can even start copying items from ItemsUpdatePanel to ItemsUpdatePanel1, and suddenly the full postbacks happen. I tried 2 seperate times, and they started happening at different times.
my requirement is like, I had a tab container in a webform, where I had two tab panels, one is for user registration, and another is for getting confirmation from the user, Now I had created the user registraton form, and need to create the user confirmation form, on confirming the user will click submit and an insert stored procedure will gets fired. Now, my main issue is like, which would be the best way, I would like to display the user entered information in the confirmation tab, like, generally, we view some records of data in a details view, using alternate row styles, in that way, I am planning, so which would be the best way, should I create a table and style it or can i use details view or grid view or form view or anything else which u can suggest.
Thing is that the user should view the page in a rich format, well structured and also how to allow the user to edit if required, and which would be the best idea, should I redirect the user back to the first panel or can we edit there itself, on the top right corner, the user should find the edit option, so how should I place it over there. Seems like a big requirement, bt expecting a big hand from you ppl to newbie like me in this technology..
I am building an asp.net application, using II6 on windows server 2003 (vps hosting).
I am confronted with an error I didn't receive on my development machine (windows 7, iis 7.5, 64 bit).
When my wcf service tries launching my query running against a local sql server this is the error I receive:
Memory gates checking failed because the free memory (43732992 bytes) is less than 5% of total memory. As a result, the service will not be available for incoming requests. To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
I have both VS 2005 and 2008 installed on my machine. 2005 is fine. For 2008, literally any asp.net project I try to create gets this eror. I try stepping into the code, and the error occurs apparently before anything that I can trap is loaded. There is no information written to the event log. I have tried this with a "Hello World" webpage with nothing else going on. Seems unique to my Windows Server 2003 machine.
I am getting a weird error in asp.net while using leadtools imaging api. Here's the stack trace.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at SetThreadData(_THREADDATA* ) at Leadtools.Codecs.CodecsOptions.Use() at Leadtools.Codecs.RasterCodecs.DoSave(SaveParams saveParams) at Leadtools.Codecs.RasterCodecs.Save(RasterImage image, Stream stream, RasterImageFormat format, Int32 bitsPerPixel)........