{"id":110,"date":"2022-01-04T11:26:13","date_gmt":"2022-01-04T11:26:13","guid":{"rendered":"https:\/\/blog.citrus-lime.com\/crmc\/?p=110"},"modified":"2022-01-04T11:26:13","modified_gmt":"2022-01-04T11:26:13","slug":"web-application-cache-how-to-empty-the-cache-by-recycling-the-app-pool","status":"publish","type":"post","link":"https:\/\/blog.citrus-lime.com\/crmc\/web-application-cache-how-to-empty-the-cache-by-recycling-the-app-pool\/","title":{"rendered":"Web Application Cache &#8211; How to empty the Cache by recycling the App. Pool"},"content":{"rendered":"\n<p>Most if not all Web-based Applications maintain a concept of Sessions (per-user) or Application (system-wide) caching, so common variables and attributes are not being loaded from storage (such as from Dynamics CRM, Config File or other Database) multiple times and leading to lower performance.<\/p>\n\n\n\n<p>There are various options on how this Session or Application Cache is stored, but probably the most common is keeping the cache held in memory within the Web Server.<\/p>\n\n\n\n<p>This means the cache lives within the Web Server Process on the Server, typically referred to as the IIS Service or the W3WP.EXE Process when viewed from Windows Task Manager:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/image_148089EF.png\" alt=\"image\" title=\"image\" \/><\/figure>\n\n\n\n<p><strong>All those cached attributes are in that \u2018w3wp.exe\u2019 somewhere!<\/strong><\/p>\n\n\n\n<p>This explains why the Memory Usage for the W3WP.EXE Process may grow on a Web Server, as the various cached attributes or sessions are being held in-memory by this process.<\/p>\n\n\n\n<p>To empty the cache, we have several options:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Restart the Server,&nbsp;<\/strong>this restarts everything and so the Web Application is forced to reload from the ground up. This definitely wipes the slate clean but also takes down our Web Application for 5-10 minutes whilst the Server reboots, and so is far from ideal!<ul><li>This does what it says on the tin, so to do this, we simply restart Windows on the Server.<\/li><\/ul><\/li><li><strong>Restart the Process,<\/strong>&nbsp;this unloads and then reloads the process running our Web Application and so forces the process to reload any cached variables. This still takes down our Web Application, but only for around 5-10 seconds rather than minutes \u2013 however it also takes down ALL the Web Applications that were running in this process, and so may impact several Web Applications running on that Server.<ul><li>To do this, we can open a Command Prompt on the intended Server and run a command for \u2018IISRESET\u2019 \u2013 this \u2018reboots\u2019 the main Web Hosting Service on the Server.<\/li><\/ul><\/li><li><strong>Recyle the App Pool,&nbsp;<\/strong>behind the scenes for the Process running our Web Applications is a series of App Pools. These App Pools run within the Process and do the heavy lifting of responding to requests for our Web Application \u2013 however each Process can host however many App Pools, and so restarting a single App Pool then only affects the Application(s) using that particular App Pool. In this way, restarting or recycling a single App Pool gives us the ability to restart a single Web Application rather than ALL the Web Applications running on that Server.<ul><li>To do this, we open Internet Information Services on the Web Server<\/li><li>Expand the Server to see \u2018Application Pools\u2019 and \u2018Sites\u2019 \u2013 click on Application Pools<\/li><li>Right click on the correct Application Pool and then click Recycle<\/li><li>This will reload all the instances of the Application within that Pool, and so empty the cache. (the application will then reload the cache when the Web Application is next loaded)<\/li><\/ul><\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image004_3688E5B5.jpg\" alt=\"clip_image004\" title=\"clip_image004\" \/><\/figure>\n\n\n\n<p><strong>Recycling a particular Application Pool within Internet Information Services<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How do we know which Web Applications are running in which Application Pool?<\/h3>\n\n\n\n<p>We can either highlight the Application Pool within Internet Information Services and then click the \u2018View Applications\u2019 option on the Right-hand side \u2013 this will then show a list of Applications running within that Application Pool.<\/p>\n\n\n\n<p>Alternatively we can expand the Sites area of Internet Information Services to then view the different Websites\/Applications that the Server is hosting.<\/p>\n\n\n\n<p>We can then highlight any one of these Web Applications to show an option for \u2018Advanced Settings..\u2019 on the right-hand side, clicking this option will then show advanced configuration settings for the website, including the ability to view and change the Application Pool that is hosting the Site.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/license.citruslime.com\/cs\/blogs\/crmcs\/clip_image006_50E8D8CC.jpg\" alt=\"clip_image006\" title=\"clip_image006\" \/><\/figure>\n\n\n\n<p><strong>Reviewing the Application Pool in use for a particular Website in Internet Information Services<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Is the Web Application Cache always held in the Application Pool \/ IIS Service?<\/h3>\n\n\n\n<p>No \u2013 occasionally we will use a separate Session Server Process or even SQL Server to retain the Application Cache and\/or Session Cache; however this far less common for smaller Web Applications.<\/p>\n\n\n\n<p>(although this is required in some form for redundant or \u2018cloudy\u2019 Web Applications that may span several Web Servers and therefore span several IIS Services, and so must manage a separate Cache\/Session storage method)<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Further Reading<\/h3>\n\n\n\n<p>Stack Overflow \u2013 what is an Application Pool?<\/p>\n\n\n\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/3868612\/what-is-an-iis-application-pool\">https:\/\/stackoverflow.com\/questions\/3868612\/what-is-an-iis-application-pool<\/a><\/p>\n\n\n\n<p>Application Pools &lt;applicationPools&gt;<\/p>\n\n\n\n<p><a href=\"https:\/\/www.iis.net\/configreference\/system.applicationhost\/applicationpools\">https:\/\/www.iis.net\/configreference\/system.applicationhost\/applicationpools<\/a><\/p>\n\n\n\n<p><strong>Introduction to the Application Pool in IIS<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.c-sharpcorner.com\/UploadFile\/225740\/introduction-to-application-pool-in-iis\/\">https:\/\/www.c-sharpcorner.com\/UploadFile\/225740\/introduction-to-application-pool-in-iis\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Most if not all Web-based Applications maintain a concept of Sessions (per-user) or Application (system-wide) caching, so common variables and attributes are not being loaded from storage (such as from Dynamics CRM, Config File or other Database) multiple times and leading to lower performance. There are various options on how this Session or Application Cache<\/p>\n","protected":false},"author":43,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_tribe_ticket_capacity":"0","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"footnotes":""},"categories":[3],"tags":[],"class_list":{"0":"post-110","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-crm"},"featured_image_src":null,"author_info":{"display_name":"jadesmith","author_link":"https:\/\/blog.citrus-lime.com\/crmc\/author\/jadesmith\/"},"_links":{"self":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/comments?post=110"}],"version-history":[{"count":1,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/110\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/posts\/110\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/media?parent=110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/categories?post=110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.citrus-lime.com\/crmc\/wp-json\/wp\/v2\/tags?post=110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}