Puakma: Under the hood

I'm Brendon Upson, jack-of-all-trades, master of one or two. I'm talking about life running a small ISV tackling business issues and leaping technology hurdles in a single bound.

webWise Network Consultants is based in Sydney, Australia and develops the groundbreaking Tornado Server technology.

Vista and the future of the desktop

Filed under: by Brendon Upson on 2006-12-13

So far it looks like Vista has made as much of a splash into the market as the mighty Zune. Barely a ripple. Why?

To me it seems like Windows XP is "good enough". It looks respectable and is pretty reliable. The value proposition for Vista is just not enough to convince users to upgrade - and by upgrade I mean buy new hardware too. That's a fair pile of cash to part with for some extra eye candy and "security"! 

What else is happening on the desktop? It seems Linux is busy chipping away while Mac OS X remains fairly constant.

"The number of servers worldwide running Linux is predicted to rise from 24
percent in 2005 to 33 percent in 2007, compared to 59 percent for Windows, according to research firm IDC.
Linux will also double its small share of the desktop PC market, which is dominated by Windows, from three percent in 2005 to six percent in 2007, IDC predicts."

Apparently Apple has around 5.8% currently so suggests in the near term Linux on the desktop will race away from Apple. From a corporate perspective this move away from Windows isn't going to happen (right now). Corporates invest huge amounts in custom software and there is a big pile of it built on the likes of .NET and VB (even MS Office is a huge reason to stay on Windows). It is  simply uneconomical to switch desktops to a non-Windows platform for fear (and cost) of having to rewrite these apps and end user training to use new applications (OpenOffice) and the new operating system UI. It seems to me that the only way Linux and Mac are going to be serious contenders is if they can natively run Windows apps.

As you probably know I am a bit of a Mac fan these days, so I may be slightly biased. I am predicting the Steve Jobs knows the above facts and has been busy repositioning Apple over the last few years to solve this application problem. First the move to the BSD based OS X, then a move to Intel architecture for the hardware, plus Rosetta and universal binaries. Parallels has recently released a beta that makes it look like you are running Windows apps inside the Mac, as does crossover office. I am predicting that with the release of Leopard next year we should expect to see some announcement regarding Windows binary compatibility.

The next few years in desktop-land are going to be very interesting! 

Programming in a parallel world

Filed under: by Brendon Upson on 2006-12-05

We have been working on a complex system for a customer which involves some serious number crunching to calculate the financial position of a project. For large projects this recalc process could take up to 15 minutes! The customer asked us to see what we could do to speed up the recalc process.

The process involves looping through a list of costcodes and for each one performing approximately 18 different SQL queries to determine its financial position. The first step was to review the code and check the SQL queries were optimised and creating new database indexes where applicable. No dice we were not able to speed up any of the queries.

The next idea was to see what parts of the process we could do at the same time. As it turns out the calculation of each costcode is a discrete process which has no bearing on the others. Perfect for parallelization.

Wait. There are a couple of pitfalls, you can't just run through the loop spawning a new thread for each process. A computer has finite resources and on a single CPU server if you launched 50 threads, chances are there would be no performance gain as all 50 would be fighting for processor time. The maximum number of threads need to be tuned to the server on which the process is running. The second is you need a mechanism for marshalling the threads, eg waiting at a point in the code for all threads to complete before continuing.

It seems to me that as processors get more cores the importance of multithreaded programming in business web applications is going to become more important.

Here's the statistics from our code change: before, the process took 14mins 30sec. After, 4mins 12sec. The only difference is now running 8 separate threads instead of 1.

I will now be looking to see how and where we can add multi-threading capabilities to Tornado for programmers to easily use in their apps. Thinking in parallel is a whole different mindset.