Answers: <p>I've seen this same "sawtooth" pattern in other systems, in particular a Java-based data tool.  Based on your description, I think you're looking at  <a href="https://msdn.microsoft.com/en-us/library/ee787088(v=vs.110).aspx" rel="noreferrer">.NET garbage collection</a> (assuming this is a .NET app.)  Java and .NET are both memory-managed languages and frameworks that use garbage collection.</p>
  
  <p>A <em>memory leak</em> is typically found in frameworks that lack memory management, or in a program on a memory-managed framework that is overriding or confusing the garbage collector.</p>
  
  <p>The fact that these are your highest-traffic servers makes sense.  You're seeing the .NET framework allocate memory as needed, then the garbage collector kicks in on a regular cycle and reclaims unused memory using the garbage collection algorithms.  Unless you're tracking specific performance issues I don't think this memory usage pattern is a problem.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-10T11:06:11.453Z
Answers: It is indeed a .NET app and from my research in the past couple days it makes a lot of sense what you and @Tensibai wrote.
Answers: António Sérgio Simões
Answers: CC BY-SA 3.0
Answers: 2017-05-09T16:23:47.167Z
Answers: 2017-05-09T16:23:47.167Z
Answers: Dave Swersky
Answers: <p>I think have found out why this graph looks like this.</p>
  
  <p>I am also gathering metrics for the ASP.NET Applications / Errors Total performance counter, and I have noticed that exactly at the same time that a memory available surge happens, the Total Errors metric resets to 0.</p>
  
  <p>According to msdn this counter resets to 0 everytime an application restart/shutdown happens.</p>
  
  <p>This leads me to believe that the cause for this Memory Available sawtooth pattern is due to Application restarts happening.</p>
  
  <p>Here's how my charts look like:</p>
  
  <p><a href="https://i.sstatic.net/uQr2r.png" rel="noreferrer"><img src="https://i.sstatic.net/uQr2r.png" alt="Errors Total ASP.NET Application"></a>
  <a href="https://i.sstatic.net/4lVpJ.png" rel="noreferrer"><img src="https://i.sstatic.net/4lVpJ.png" alt="Memory Surge"></a></p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>This happens because the Private Bytes of the W3WP process hit the limit for a recycle (We have a private bytes limit configured in the app pool). And looking closely to the Private Bytes chart, we can see something abnormal is happening because Memory usage leaps from 650MB to 3.2GB and a few hours later leaps from 3.6GB to 16.6GB! This is when the recycle happens.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-15T12:54:07.310Z
Answers: This is much more plausible explanation. Sudden memory freeing happens almost exclusively with process restarts. Mechanisms to free memory of running processes are never this sharp and rarely actually free the memory rather than freeing some space on preallocated heap.
Answers: Jiri Klouda
Answers: CC BY-SA 3.0
Answers: 2017-05-15T10:02:18.817Z
Answers: 2017-05-15T12:43:39.960Z
Answers: 2017-05-15T12:43:39.960Z
Answers: António Sérgio Simões
Body: <p>I have a few VMs on Windows Azure that run our ecommerce website, and lately we started using Telegraf, InfluxDb and Grafana to keep an eye on these machines. After a couple weeks of gathering data, I have noticed a weird pattern related to the Memory <em>Available</em> metric:</p>
  
  <p>Everyday almost always at the same period of the day, I have noticed that there is an abrupt amount of memory being freed up which, due to my very very very limited DevOp skills, I cannot figure out what is causing this.</p>
  
  <p>Here's a chart that shows this pattern:</p>
  
  <p><a href="https://i.sstatic.net/viFSv.png" rel="noreferrer"><img src="https://i.sstatic.net/viFSv.png" alt="Odd pattern"></a></p>
  
  <p>My question is: What could lead to something like this? I feel tempted to suspect that a Memory Leak is to blame but...Free memory never drops below 70% and only happens in two of the VMs with the most traffic!</p>
  
  <p>Should I be concerned when I see something like this?</p>
  
  <p>P.S.: I have stared gathering metrics for Private e Virtual bytes for each of the windows services we have running and for the w3wp process...although I have read that this metrics are not very reliable to find out if you have a memory leak, but at least I'll try to get some sort of trend and see if it correlates with the pattern shown above.</p>
  
Comments: CC BY-SA 3.0
Comments: 2017-05-09T12:33:51.260Z
Comments: You're seeing an usual garbage collector or cache cleaning IMHO. In wich language is your website done ? (this could be your app, your websever, and even the system doing some cleanup)
Comments: Tensibai
Comments: CC BY-SA 3.0
Comments: 2017-05-09T13:18:34.877Z
Comments: That was something I was suspecting too...It's done in ASP.NET MVC 4, so the garbage collecting theory makes some sense.
  Also, on a side note, the metrics I've been gathering on the w3wp process and windows service look absolutely normal.
Comments: António Sérgio Simões
Comments: CC BY-SA 3.0
Comments: 2017-05-09T13:30:15.840Z
Comments: I'm know nearly nothing in ASP, but I assume there's way to graph the memory consumption and garbage collection as in java, this should help ensuring this is the root cause.
Comments: Tensibai
Tags: <azure><windows>
Title: Memory being abruptly freed up every day at about the same time
UserDisplayName: António Sérgio Simões
ThreadText: # Memory being abruptly freed up every day at about the same time
  
  (Asked by: username_0 on 2017-05-09)
  
  I have a few VMs on Windows Azure that run our ecommerce website, and lately we started using Telegraf, InfluxDb and Grafana to keep an eye on these machines. After a couple weeks of gathering data, I have noticed a weird pattern related to the Memory *Available* metric:
  
  Everyday almost always at the same period of the day, I have noticed that there is an abrupt amount of memory being freed up which, due to my very very very limited DevOp skills, I cannot figure out what is causing this.
  
  Here's a chart that shows this pattern:
  
  [![Odd pattern](https://i.sstatic.net/viFSv.png)](https://i.sstatic.net/viFSv.png)
  
  My question is: What could lead to something like this? I feel tempted to suspect that a Memory Leak is to blame but...Free memory never drops below 70% and only happens in two of the VMs with the most traffic!
  
  Should I be concerned when I see something like this?
  
  P.S.: I have stared gathering metrics for Private e Virtual bytes for each of the windows services we have running and for the w3wp process...although I have read that this metrics are not very reliable to find out if you have a memory leak, but at least I'll try to get some sort of trend and see if it correlates with the pattern shown above.
  
  **Tags:** azure, windows
  
  > **Comments:**
  > **username_1**: You're seeing an usual garbage collector or cache cleaning IMHO. In wich language is your website done ? (this could be your app, your websever, and even the system doing some cleanup)  
  > **username_0**: That was something I was suspecting too...It's done in ASP.NET MVC 4, so the garbage collecting theory makes some sense. Also, on a side note, the metrics I've been gathering on the w3wp process and windows service look absolutely normal.  
  > **username_1**: I'm know nearly nothing in ASP, but I assume there's way to graph the memory consumption and garbage collection as in java, this should help ensuring this is the root cause.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-05-15. Score: 7 | Accepted answer
  
  I think have found out why this graph looks like this.
  
  I am also gathering metrics for the ASP.NET Applications / Errors Total performance counter, and I have noticed that exactly at the same time that a memory available surge happens, the Total Errors metric resets to 0.
  
  According to msdn this counter resets to 0 everytime an application restart/shutdown happens.
  
  This leads me to believe that the cause for this Memory Available sawtooth pattern is due to Application restarts happening.
  
  Here's how my charts look like:
  
  [![Errors Total ASP.NET Application](https://i.sstatic.net/uQr2r.png)](https://i.sstatic.net/uQr2r.png)
  [![Memory Surge](https://i.sstatic.net/4lVpJ.png)](https://i.sstatic.net/4lVpJ.png)
  
  **UPDATE**
  
  This happens because the Private Bytes of the W3WP process hit the limit for a recycle (We have a private bytes limit configured in the app pool). And looking closely to the Private Bytes chart, we can see something abnormal is happening because Memory usage leaps from 650MB to 3.2GB and a few hours later leaps from 3.6GB to 16.6GB! This is when the recycle happens.
  
  > **Comments:**
  > **username_3**: This is much more plausible explanation. Sudden memory freeing happens almost exclusively with process restarts. Mechanisms to free memory of running processes are never this sharp and rarely actually free the memory rather than freeing some space on preallocated heap.  
  
  ---
  
  ### Answer by username_2 on 2017-05-09. Score: 7
  
  I've seen this same "sawtooth" pattern in other systems, in particular a Java-based data tool. Based on your description, I think you're looking at [.NET garbage collection](https://msdn.microsoft.com/en-us/library/ee787088(v=vs.110).aspx) (assuming this is a .NET app.) Java and .NET are both memory-managed languages and frameworks that use garbage collection.
  
  A *memory leak* is typically found in frameworks that lack memory management, or in a program on a memory-managed framework that is overriding or confusing the garbage collector.
  
  The fact that these are your highest-traffic servers makes sense. You're seeing the .NET framework allocate memory as needed, then the garbage collector kicks in on a regular cycle and reclaims unused memory using the garbage collection algorithms. Unless you're tracking specific performance issues I don't think this memory usage pattern is a problem.
  
  > **Comments:**
  > **username_0**: It is indeed a .NET app and from my research in the past couple days it makes a lot of sense what you and @username_1 wrote.  
  
  ---
  
  