-1

I have a few Web APIs running on Windows 2016 server.

State 1. This is what the memory usage on my server looks like when I didn't use the APIs for more than 25 mins. And it takes quite long to execute the first tasks at this point. enter image description here

State 2. While waiting for the APIs to complete initial tasks, This is what it looks like. enter image description here

As you see, APIs are probably getting loaded onto the Server's RAM.

State 3. After finishing the initial tasks, it seems like the APIs are fully loaded on the RAM and APIs react very quickly at this point. enter image description here But again, if I don't use the APIs for about 25+mins, it goes back to state 1. How can I make the server to keep the APIs in its memory for a longer time? I am hoping it to have the APIs loaded for at least 1 hour, and I used MVC and MVC CORE to build the APIs.

Thank you very much for your help.

A J
  • 53
  • 1
  • 11
  • See https://msdn.microsoft.com/en-us/library/ms525803(v=vs.90).aspx – haim770 Apr 26 '18 at 15:38
  • Your application pool is being recycled. This won't have anything to do with Web API or MVC, it's how IIS manages memory since the early versions. If an application isn't used in a while (normally 20 minutes) it will tear it down to conserve resources. Since 2012, Application pools also have a 'Start Mode' that can be set to Always Running. This should help keep your apps hot and available. https://blogs.msdn.microsoft.com/vijaysk/2012/10/09/iis-8-whats-new-application-pool-settings/ – Mark Fitzpatrick Apr 26 '18 at 16:05
  • @MarkFitzpatrick Thank you, I didn't exactly know where to address this issue and your comment guided me to the answer. It was IIS configuration issue. Even though the site you sent me didn't directly help me, it hinted me to the right direction. This is how I resolved it. – A J Apr 26 '18 at 18:47
  • https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/idle-worker-process-page-out-in-iis85 – A J Apr 26 '18 at 18:47

1 Answers1

0

I did not exactly know what the issue is, but thanks to @MarkFitzpatrick, I got a big hint from his reply. The problem had something to do with IIS configuration, and this is how I resolved it.

https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-85/idle-worker-process-page-out-in-iis85

A J
  • 53
  • 1
  • 11