Rip's Domain

BannerBoxes 2.o behind the scenes.

Posted in ColdFusion by rip747 on July 17, 2006

For those that don’t know, I’m one of the owners and the sole coder behind (BB). BB is an advertising services similar to Google AdSense in some ways. This weekend we finally launched version 2.0. What does this have to do with CF you might ask… keep reading.

We’ve been wanting to rewrite BB for quite sometime now. The site was good and the code was OK, but I always felt that I could push the limits of CF a lot more and get way more performance from it. The site was original written around CF5 and of course had a lot of procedural code and was a pain to maintain and upgrade. With that, the decision was made to rewrite BB from the ground utilizing CFCs to encapsulate the business logic and move it out of the database. This would make it a lot easier to upgrade and add features to BB in the future as well as fix any bugs that we might come across. We also wanted to use CFCs to cache as much of the database in memory as we could to minimize the load on the database server as it’s easier and cheaper to add web servers than a database server.

It took 3 months to rewrite BB from the ground up and I must say that it was well worth it. On the old code the CF server CPU was hovering around 30% – 50%, the database server was sitting at a constant 20% – 25%. With the new code and optimizations now possible with CFCs, the CF server is at 10% – 15% and the database server at 1% – 3%. This is a tremedous performance increase.

With that I’ve decided to go behind the scenes of this rewrite and share in the triumphs and struggles that occurred. I’m going to post some of the source code that we use on BB from both CF and MSSQL. I’m going to explain how and why we do things in order to squeeze every last bit of performance that we can from CF and MSSQL. Why am I doing this? Well for several reasons:
First it’s always fun to look at someone else’s code and pick it apart. Very rarly in our business do you get to see the source code from a site unless you’re hired to work on it.

Second you might learn something new. Someone out there might be doing a project similar to BB and these posts could shed some light on a part that they’re stuck on or having trouble with.

Third, I’m no expert; am I good at what I do, of course, but I’m not the best. Someone out there could look at the code and tell me that I could get more performance if I do this way. That right there is worth it’s weight in gold.

So stay tuned for the posts. I think I’m going to start with how we structured the site and the home grown framework that we used to build the site. Remember that along the way please post criticisms and suggestions. And check out! Tell me what you think of the site and what we could to make it better, please, we want to hear it; even if it’s so-so is better because they do this and you guys don’t.


One Response

Subscribe to comments with RSS.

  1. Jason said, on July 17, 2006 at 4:57 pm

    Thanks for this I will be staying tuned 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: