{"id":11,"date":"2008-02-01T16:59:03","date_gmt":"2008-02-01T21:59:03","guid":{"rendered":"http:\/\/www.peteonsoftware.com\/?p=11"},"modified":"2010-03-23T20:16:33","modified_gmt":"2010-03-24T00:16:33","slug":"a-speed-problem","status":"publish","type":"post","link":"https:\/\/www.peteonsoftware.com\/index.php\/2008\/02\/01\/a-speed-problem\/","title":{"rendered":"A Speed Problem"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/www.peteonsoftware.com\/images\/speed.jpg\" alt=\"Speed\" style=\"float: left; padding: 0.5em\" title=\"Speed\" \/>First let me give you a little of the background. At work, we are building a web application. Among other things, we&#8217;d like it to be fast. We made many painstaking decisions to build it to be fast. My <a href=\"https:\/\/www.peteonsoftware.com\/?p=9\">last post<\/a> talked about some of the things that we were going to undertake to make sure that it was fast through the pipe.<\/p>\n<p>However, we were having a problem. Page loads were taking over 5 seconds and that was after the initial hit penalty that ASP.Net gives you. I put tracing information in our handler and it turns out that all of our framework code was executing in .05 seconds. That wasn&#8217;t the problem. The step of getting the base handler (for the hand off to ASP.Net) however, was taking over 5 seconds.<\/p>\n<p>We had another interesting problem. The ASP.Net Cache object didn&#8217;t work. It would be alive for the duration of a page hit, but on the next hit it was gone. My boss suggested that the pages were compiling every time, and we ultimately did see that in the %windir%\\Microsoft.NET\\Framework\\v2.0.50727\\Temporary ASP.NET Files directory. The question was, &#8220;Why?&#8221;.<\/p>\n<p>We had wanted the site files to be dynamically compiled for ease of updating, while our framework code remained in pre-compiled .dlls. To troubleshoot, I recommended that we pre-compile the website as well and see what happened. Page hits got down to half a second a piece. Interesting.<\/p>\n<p>Shortly after, though, I got a brainstorm. We were writing log files into a folder in the bin directory (a holdover convention from a previous application) and every time that directory changed (on every page hit), ASP.Net would sense that the bin directory changed (since the log folder was in it and a part of it) and think that the site had changed and now needed a recompile. It makes perfect sense in retrospect!<\/p>\n<p>We moved the log directory outside of the bin, went back to dynamic compilation, and got the same performance improvement that we got with the pre-compiled version &#8211; much to my relief.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>First let me give you a little of the background. At work, we are building a web application. Among other things, we&#8217;d like it to be fast. We made many painstaking decisions to build it &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[86],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","hentry","category-code-optimization"],"_links":{"self":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":0,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.peteonsoftware.com\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}