December 2005 - Posts

Problem with ASP.Net initial page loading time?

I have a few domains registered that are running asp.net code. I used to wonder why, sometimes, if I haven't used the page for a few hours it would take about 10 seconds to load up the first time. I actually thought this was a problem with ASP.Net -- that it was caching the code or something, and having to recompile if it wasn't accessed for a while.

After doing a bit of investigation, it turns out this isn't ASP's fault at all. Not IIS or even the web host that I'm using.

It turns out it's DNS. Because domain name lookups are cached for a certain amount of time, if nobody using your local domain server has requested the website, the cache will be cleared. This means it has to do a lot more work to resolve the domain name the next time it's requested.

To test this out, I added a link to my website by IP address rather than domain name. Sure enough it was super fast to load, every time, even if I haven't accessed it for a few days. And, even after loading up the page instantly by IP address after a few days, if I then tried to access the page by domain name -- once again it's delayed about 10 seconds before it loads.

What can you do about this? Not much really. It's not really recommended, but assuming you have a static IP associated with your web page, you could encourage people to use the IP rather than the domain name. If you're concerned about browsing time to your favorite sites, you could make make all your shortcuts point to the IP address.

At least this information should save you from cursing ASP for something which is basically a DNS issue.

Tackling Microsoft's ever-moving goal posts

The technology industry changes a lot. In fact if you use Microsoft technology it seems like it changes every season. You start out feeling like you're finally getting the hang of programming MS-DOS through interrupts, when along comes Windows. Then you start to get the hang of Win16 and DLLs… which becomes Win32… and then comes along OLE… which becomes ActiveX, we discover Visual Basic but the Internet takes over and we're briefly diverted to JavaScript and DHTML, then Microsoft start developing frameworks for Java and so everyone jumps on that bandwagon. Then by surprise they make a huge anouncement and we start all over again with .Net. Couple of revisions later we get told that the APIs we're using in .Net will be made obsolete in favor of some new technologies - Windows Presentation Foundation to name but one. And this happens all in the space of about 12 years.

Now given it takes a good few years to develop a decent product, it sometimes feels like you're trying to stand upright on a moving rug that just won't stop moving. In fact it sometimes feels like this might just be a deliberate ploy to stop ISVs from making money. It looks like competition through distraction.

Microsoft is a huge company. They certainly do have direction, they certainly have the concepts right, but the implementation can sometimes seem like it's stabbing in very dim light. They're really so big that they have a huge playground in which they can play lots of different games and see which one lasts the longest and performs the best. Usually they're forced to release intermediate technologies simply to stay relevant and stay in the market.

I think WPF, WCF, WWF and all those W acronyms are great technologies and are definitely the future. If this is what comes out of a decade of attempts, then that's a whole lot better than being stuck with text mode DOS screens and using escape sequences to make pretty colors.

Does this mean we should start all over again every time Microsoft has a new idea? Of course not. For ISVs the most important thing they should spend their time doing is creating an asset that makes money. If you want to hammer a nail into a wall, you pick up a hammer. If every time you pick up the hammer someone hands you a new one, or you sit waiting for a zero gravity automatic hammer to become available, you'll spend a whole lot of money and time and you probably won't have anything to hang that picture on. For an ISV this can be a fatal mistake.

Competitors and market forces ensure that we stay on the bleeding edge of technology. But it's always important to keep in mind the customer: The users drive the requirements, not the latest technology.

I will certainly start introducing bits of WPF and WCF into my applications. But only when it makes sense, and only a component at a time. I certainly won't be throwing away 8 years of development on a product so I can rewrite it using the latest technology, because who would that be serving?