1

I have tried looking at "related" questions for answers to this but they don't seem to actually be related...

Basically I have a VB.Net application with a catalogue, administration section (which can alter the catalogue, monitor page views etc etc) and other basic pages on the customer front end.

When I compile and run the app on my local machine it seems to compile fairly quickly and run very fast. However when deployed on the server it seems to take forever and a day on the very first page load (no matter what page it is, how many stylesheets / JS files there are, how many images there are, how big the page markup is and so on). After this ALL the pages load really fast. My guess is this is due to having to load the code from scratch; after that, until it is recycled, the application runs perfectly fast. Does anyone have any idea how I could speed this part of the application up? I am afraid that some customers (on slow connections such as my own at less than dial-up speed) may be leaving the site never to return as a result of it not loading fast enough. Any help would be greatly appreciated.

Thanks in advance.

Regards,

Richard

PS If you refer to some of my other questions you will find out a bit more about the system, such as the fact that most of the data is loaded into objects on the first page load - I am slowly sorting this out but it does not appear to be making all that much of a difference. I have considered using Linq-to-SQL instead but that, as far as I know, does not give me too much flexibility. I would rather define my own system architecture and make it specific to the company, rather than working within the restrictions of Linq-to-SQL.

Geo
  • 12,666
  • 4
  • 40
  • 55
ClarkeyBoy
  • 4,934
  • 12
  • 49
  • 64
  • Is it a Web Application or a Web Site? Is it Precompiled? How long exactly is "forever and a day"? – bzlm Jan 19 '11 at 22:22
  • It is a web application, set up in Visual Web Developer. I always compile my apps before I send them into the live or test environments. Forever and a day ranges from about 5 seconds to 10 or 15 seconds. It seems to vary drastically. I mean it could easily be affected by the time of day, if there are some high volume sites on the same server, but it doesn't seem to be particularly fast at any time of the day. – ClarkeyBoy Jan 19 '11 at 22:26
  • The question I have is why aren't you, after posting an update, the first user to view the page and "bite the bullet" for your clientele? – Brad Christie Jan 19 '11 at 22:27
  • I think there must be a misunderstanding here. The application is recycled after about 5 minutes or so of inactivity (this is the default on the server - I have no control over this). It is the first page view after this that is slow. Any page views after this, within 5 minutes of the previous page view, is very fast. Check it out at http://live.heritageartpapers.com - load a page, wait half an hour and load it again. Then try loading a different page. You should find the same results as me. – ClarkeyBoy Jan 19 '11 at 22:30
  • Please tell us exactly what type of Visual Studio project your site is. MVC, Web Site, Web Application? – quentin-starin Jan 19 '11 at 22:47
  • It is a bog standard ASP.Net Empty Web Application in VB. I simply went to File > New Project > ASP.Net Empty Web Application, gave it a name and clicked Ok. If you need any more specifics then please say what and I will go and find out. – ClarkeyBoy Jan 19 '11 at 22:55
  • Switch to PHP. (No, I couldn't say that with a straight face.) – 3Dave Jan 19 '11 at 23:47
  • I have actually tried PHP in the past. I just don't get on that well with it... I just prefer strongly typed languages, where data type actually matters... Having said that, I have been to interviews for a couple of PHP jobs recently on the basis that I would like to and am eager to learn new languages and I do so very quickly. Besides in this case switching languages just isn't an option - it is too big to convert in a sensible amount of time. – ClarkeyBoy Jan 20 '11 at 00:22
  • @ClarkeyBoy - I was kidding. I am not, by any means, a fan of PHP. .NET is a far more stable, maintainable and powerful platform, and I get nauseous if I see too many dollar signs in one page of code. – 3Dave Jan 20 '11 at 16:39
  • Yeah I kinda guessed you were kidding. For me its too many £ signs which get to me, particularly if there is a - sign on their left! Unfortunately I am seeing a lot of those at the moment having just come out of university... :( – ClarkeyBoy Jan 20 '11 at 17:26

1 Answers1

0

If you can, the quickest easiest solution is simply to configure the AppDomain not to recycle after a period of inactivity. How this is accomplished differs between IIS 6 & IIS 7.

Another option is to write a small utility program that requests a page from your site every 4 minutes and set it up as a scheduled task on another PC that is on all the time. That at least will prevent the timeout and consequent AppDomain recycle from happening. It is a hack, to be sure, but sometimes any solution is better than none.

The proper solution, however, is to precompile your views. How exactly to accomplish and deploy that will depend on the exact type of Visual Studio project your web site is.

quentin-starin
  • 26,121
  • 7
  • 68
  • 86
  • Thanks qstarin. I will investigate this, but as I said in a comment on my question I do not think I have any control over this whatsoever. I mean I have the session timeout set to an hour and yet users (luckily only admin at the moment) are logged out after 5 minutes of inactivity. I can find no reference to 5 or 300 (seconds) or anything similar in the config file or the control panel. – ClarkeyBoy Jan 19 '11 at 22:32
  • do you have any access to the IIS Management Console? Some shared hosts do allow it, Arvixe for example offers remote IIS administration where I can use the management snap-in as though I were on the server pulling it up from Administrative Tools. It is in the IIS Management - not in a web.config - where that option can be changed. Otherwise, you'll have to pre-compile the views. Even though you compile the project, the views are still by default compiled as needed and that is where the delay happens. – quentin-starin Jan 19 '11 at 22:45
  • I don't think I do have access to IIS. I mean basics, yes, such as recycling applications on demand or altering the web.config through their interface. But more advanced features I don't have access to. Having said that, it would be worth contacting the host (Intrahost) tomorrow to find out if they are able to change it for me or if there is some way that I can access that I have missed. – ClarkeyBoy Jan 19 '11 at 22:50