Planning for Growth

Back Draft

 

Planning for Growth

 

By Jonathan Goodyear

 

I love Christmas lights. Each year, I go to the hardware store and spend way more money than I should in my ongoing quest to create the ultimate holiday visual extravaganza. Up to a point, expanding my Christmas display was easy. Just buy stuff, plug it in, and enjoy.

 

After amassing nearly 100,000 lights, though, things start to get a bit tricky. For instance, it becomes important to have multiple electrical sockets on the exterior of your home to service all the lights that you ll be plugging in. Before, I always laughed at the warnings on boxes of lights that state you shouldn t chain more than 450 lights to a single electrical socket. Although 450 lights is a low (but safe) limit, I turned a theoretical limit into reality a couple of years ago after chaining nearly 5,000 lights to a single electrical socket. Big explosion. Big electrician bill.

 

When I moved into my new house last year, I made sure it had a lot of exterior electrical sockets. However, I ran into the limit of how much total power my lights could consume before my house s master circuit breaker started breaking. It was time to install a dedicated circuit for my lights.

 

In addition to the Christmas lights on my house, I also like to decorate my trees and bushes. Because I didn t buy a home that had electrical sockets pre-installed in the mulch beds of my trees, I have to have extension cords strewn all over my yard, running from mission control to each tree. Occasionally, I tempt fate and chain multiple tree circuits together, but past pyrotechnic experiences limit my willingness to take such risks.

 

The thing about extension cords is that you have to make sure you have the right ones. If you don t buy heavy duty cords with water-tight connectors, you ll end up with a circuit breaker tsunami when you accidentally leave your lights on in the rain or your sprinkler system turns on (been there). After awhile, all of this Christmas fun isn t so fun anymore.

 

Why do I bring up my Christmas light adventures in an ASP.NET magazine? As the title of this piece suggests, it is very important to plan for the growth of any system. A little extra money and thought now can save you a lot of money and problems down the road. In the case of my Christmas lights, I should have proactively installed a larger dedicated power circuit for my home since I knew I was going to put a strain on the system. I should have either bought or built a home that had electrical sockets throughout my yard where I would need them come holiday decorating time. I should have spent the extra money to buy industrial-strength wiring before witnessing first-hand the outcome of water meeting electricity.

 

Likewise, when you are setting out to build a new ASP.NET application, don t just think about what the application needs to do now, or how many people it needs to service now. Take a moment to look into the future and determine what the application will need to do and how many people it will need to service a year from now (perhaps longer). You can t avoid all the expenditures of growth down the road, but you most certainly can minimize the damage.

 

For instance, let s talk a bit about hardware (did I just say that in a software magazine?). I strongly recommend buying separate database and Web servers. If you need to add Web servers down the road to create a Web farm, all you ll need to do is create an image from your existing Web server, instead of having to de-couple your database from the mix (which can be time consuming, even if done correctly the first time). Spend a little extra to get servers that can house four or more processors and a lot of RAM, even if you re only planning to use one processor and a smaller amount of RAM to start out. You ll avoid having to scrap your servers and replace them with better hardware down the road (at considerable cost). There are other hardware factors to consider, like networking infrastructure and using a managed hosting provider (which I highly recommend), but you get the idea.

 

Let s move on to software considerations. From a licensing perspective, it pays to take advantage of Microsoft s Software Assurance program (http://www.microsoft.com/licensing/programs/sa/default.mspx). That way, you don t get stuck with a huge bill when new product versions come out with features that you want to leverage in your application. Also, when choosing third-party components, developers typically concentrate on feature sets and don t pay too much attention to how those components work under a heavy load. There is often a big difference between vendors in this key differentiator. For instance, Dundas products will set you back a bit more than its competitors, but they are specifically designed and optimized for extremely high-load scenarios (http://www.dundas.com). If your Web application becomes as popular as you want it to, you ll be glad you don t have to re-tool because of a third-party component that can t keep up.

 

There are also several things that you can do in your code to reduce the pain of scaling up. For example, minimize the number of calls that you make to the database on each page request. It sounds obvious, but you d be amazed at how many times I am hired to optimize a piece of code that calls the database one time for each iteration of a loop, or when developers request the same data from the database multiple times on a single page request instead of storing it in Context.

 

A second thing that you can do to optimize your code is to modularize your diagnostic code. Diagnostic code can be a real drain on processing, so add it all into an HttpModule that you can snap into your application when you need to track down an issue. You can then strip out the reference to it from the web.config file when your debugging task is complete. Finally, you can minimize the amount of data that your Web server needs to serve up. A couple of ideas to help you along that path are to eliminate your usage of ViewState wherever possible, and use CSS to describe the visual characteristics of the UI elements on your Web pages, instead of individual style elements that can be costly from a bandwidth perspective.

 

With any task upon which you embark in life, planning is crucial. Time and money spent now can have an enormous effect on how things turn out down the road. There are always multiple trade-offs to consider, but it helps to take a longer view of the situation and give the implications of the future of your application their due attention.

 

Jonathan Goodyear is president of ASPSoft (http://www.aspsoft.com), an Internet consulting firm based in Orlando, FL. Jonathan is Microsoft Regional Director for Florida, a Microsoft Certified Solution Developer (MCSD), and author of Debugging ASP.NET (New Riders). Jonathan also is a contributing editor for asp.netPRO. E-mail him [email protected] or through his angryCoder eZine at http://www.angryCoder.com.

 

 

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish