My First MySQL Outage at HostMonster

December 10th, 2008

hostmonster.jpg

Today I had my first outage at HostMonster, my hosting service. That's pretty impressive. More than a year and a half and no significant problems. This morning I couldn't post an article to my weblog and saw that the MySQL database server was down. Pretty easy to see.

I sent in a trouble ticket, and with the hour things are back up. I have to say, for the price I pay (which is not a lot) this is fantastic service. Sure, it's not a lot to them, but it's their business, and something I don't have to worry about. I have enough of those things.

So kudos to HostMonster. Not for being perfect, but for being really good.

[12/11] UPDATE: the tech support response from HostMonster said that if MySQL went down, it would repair itself and come back up. Seems reasonable to have it restart. Good enough.

Making the Case for Multi-Threaded Applications

December 10th, 2008

GeneralDev.jpg

I have listened to a lot of people say that multi-threaded programming is dangerous, and can be avoided with careful planning. I can see their argument: a properly created finite-state machine with sufficiently small processing chunks can appear to be processing many things at once on a single thread, but that's an illusion. A bad one at that.

First, the effort to write good multi-threaded code is simpler than making the equivalent finite-state machine code. I know, I've done both. You can do the finite-state machine, and it's great on old hardware, or single-core machines, but it's not necessary. Most machines now are multi-core, and getting more and more with each generation. No. You need to know how to write multi-threaded code in today's high performance systems. No two ways about it.

Second, there are times when the overhead of 'polling' in the finite-state machine construct overwhelms the processing that really needs to get done. There's a reason we went to interrupt-driven I/O over polled I/O - one is much more efficient than the other - but harder to code. Suck it up, Boys! Code like you're worth the money they are paying you! Write the code that should be written - not the easy stuff - the hard stuff.

I've been working with a package that has a central object repository, and caches in each API instance. This is smart in that it allows for the client to grab something, and then hold on to it for many requests so that there's not a continual re-fetching if the data doesn't change. Nice. Problem is - they made the API cache single-threaded. This means that in order for a client to get any updates, it has to ask for them.

Normally, this isn't a horrible problem, but if the asking requires a re-fetching (as opposed to getting just the updates), then the more things there are in the cache, the worse it is on performance. Remember - this is single-threaded, so they aren't going to let you do anything until the re-fetching is done.

What they should have done is to make the cache update in a background thread with a simple "complete replacement" when the update arrives. Keep the bulk of the API single-threaded, but as updates flow into the API's cache, allow them to update a hidden copy of the object, and then lock the API thread, swap out the objects, and unlock the thread. This way, the cache stays consistent with the data in the central object repository.

Why is this important?

Because let's say I get an object and modify it. I've got a new copy, and I save it to the central object repository. Now another user does a similar action. They get the copy, modify it, and now my copy is stale. This is bad, because if I don't ask for updates, I may try to edit it more, and save those changes. Well... that's not going to do because my 'before' copy is not what the central object repository has. This means it's going to throw an exception.

But what about my edits? They have to go. No choice. I have to re-fetch, and then start over again.

Without even the simple flag like "re-fetch me", which could easily be added to the API under the covers, I have no idea that my work will be in vain. But it will.

This is the case for multi-threading that I'm making. There are times that you need to simplify the problem into multiple threads and have one dedicated to the simple task of making sure the cache is consistent. It's simple, surgical, and not hard to do. The results would be dramatic in the simplification of the client code.

So learn how to write multi-threaded code. Many times, it's the simplest way to get what you need done. And in the era of 60-core boxes, you're going to need it to get the most out of any box.

Office Politics Played Poorly

December 10th, 2008

cubeLifeView.gif

I was talking to a co-worker this morning - just after we arrived. I told him I heard that he'd be doing some web development - something I heard from the management team yesterday when they asked me about setting him up with a development box and such. He didn't look thrilled. I don't blame him. From his point of view, it's bad bad news. The one guy in this place that he outwardly hates, and outwardly hates him is the IT manager. This puts him under this guy and subject to his (often quite loud) rants. I've come to understand that they are as much a part f life here as the carpet and window cleaners. He's not yet at that point.

So he's trying to put a positive spin on things, and see it as once again, paying his dues, in order to get back to the place he was, and hopes to be again - quant trader-guy. Certainly an admirable goal, but there are many things standing in his way - not the least of which is the open feud between this guy and the IT manager.

My friend plays politics very poorly. He admits this. Maybe he's got a plan to learn better political skills, or maybe he's just going to sit tight and keep his mouth shut and try to ride this out. Not surprisingly, the "shit down and shut up" plan works remarkably well here, I'm guessing because so many people are pretty smart, and there's nothing a fragile ego likes more than to boss around someone who they fear is superior in some way.

But I'm not sure this is going to end up all that well. With the current financial crisis as the backdrop, there have been a lot of cuts - people and things, at a lot of organizations. I haven't heard anything definite about this place - yet, but it would not surprise me if the Bank as a whole decided cuts had to be made, and we ended up having to cut a few people. Wouldn't make it right, but it wouldn't surprise me.

Given this, I plan on doing what I've been doing, and simply acting like a little, neutered, slave and say "Yes" to everything they say. Oh, I'm not afraid I'm going to get cut, but there's no reason to ask for the unwanted focus at this time, either. Keep your head down, and let the storm blow over - it will... eventually.

I'm just not sure if my friend is capable of that. Maybe so, and if he is, he's learning, I'll give that to him. Previously, he'd have stood up and told them all they were acting timidly. It would have been right, but politically, it was suicide. So now he's looking at doing web pages.

He's a decent guy that doesn't deserve to have the political problems he has, but he did admit that he brought them down upon himself. I just hope this doesn't come back to haunt management or my friend.

Coda 1.6.2 Fixes Several Annoying Bugs

December 10th, 2008

Coda.jpg

This morning I noticed that Coda 1.6.2 is out, and the release notes indicate that there are a few FTP bugs fixed as well as some cosmetic highlighting and a maintenance issues. Not really earth-shattering, but I'm guessing that with the FTP process being so critical to Coda's functionality they wanted to get this out as soon as possible.

Once again, it's great to have products that are created by indie Mac developers. They see the problem, fix it, and post a release. It's that closeness with the customers that I like.

The Honorable Felon – Bad, even for Chicago

December 9th, 2008

WhiteCollarCrime.jpg

Just when you think corruption can't set any worse, this story breaks, and you realize that you can't honestly support a person who does this, no matter what good they might have done.

Selling a Senate Seat.

I shake my head at the complete absurdity of the notion.

People who represent us should know better. Hopefully, with this, they will.

Fixing a Squeaking Boot – Fantastic!

December 9th, 2008

NetworkedWorld.jpg

In the winter I wear my hiking boots as I want my feet to be warm and dry throughout the entire, miserable, season. OK, no more editorializing. The problem was that I had a squeak in my left boot, and it was getting louder, and I was thinking it's time to get a new pair.

But I hate replacing things if I can fix them. So I went to Google for 'squeaky shoes'. I love the internet.

Turns out a really good fix for squeaky shows is to take out the insole and slather a bunch of lotion or ChapStik on the inside. I went with the lotion because I have a jumbo Baby Lotion at my desk, and I love the smell of the Baby Lotion - reminds me of my kids when they were little.

Anyway, I smeared a thin layer over the bottom of the boot, put the insole back in, and Shazam! the squeak was gone. I'm blown away. I love the internet.

Figured Out the XY Line Graph Secondary Y Axis

December 9th, 2008

comboGraph.png

This morning I was reading the JavaDocs for VantagePoint's TwoDimCrossScatterViewer to see if I was missing anything on the secondary Y axis issue I was having yesterday, and I saw it. In working with the new graph type we have two ways of looking at the data - as pairs and as columns. In the first cut I assumed they wanted the pair number. There, in the docs, was the key I'd been missing. In the docs for the TwoDimCrossScatterViewer was the method:

    public void setSecondary(int colNum, boolean isOnSecondary)

Clear as day... they are saying that in order to put a column on a secondary axis, you have to specify the column. Not the pair. You can put either the X or Y on the primary or secondary axes - making this far more configurable than I had planned. This was very clever of Gordon. Love it.

The result is beauty:

Working XY Line Graph

I fired off an email to Gordon to tell him I "got it", and to ask him which question of mine he wanted to answer next. There were three:

  • How to format Dates on Time Series Graphs - this is so we can make better line graphs for the developers doing a lot of time-series data.
  • How to put Labels on the bars in Bar Graphs - this is in order to make the data identified in the graph and not by the legend.
  • How to put Bars in a TimeSeries Graph - another developer wanted to have bars and not lines on the time series - another graph I'd have to add support for.

VLC 0.9.8a is Out – No Sparkle?

December 9th, 2008

VLC.jpg

VLC 0.9.8a - a security update for a problem in the Real codec, is out today. I found out by starting VLC to play a little downloaded YouTube video ('The Website is Down'), and it said there was an update, and asked me if I wanted to download it. "Sure", I say.

Then it acts as if I'm downloading a file - not updating the app. What gives? These guys make a Mac OS X app and don't even bother to use Sparkle? It's free and will do all the upgrade stuff for you. If not Sparkle, then the Google Code updater, update-engine. There are just too many reasonable ones out there to have something like VLC that's been in the works for so long, not to use one.

Anyway... it's updated now.

Grrrr… Comcast is Down

December 9th, 2008

pirate.jpg

OK, there's a few things that get under my skin, and Comcast being down is one of them. It's not the end of the world - it's not even a reason to get really angry... but it's part and parcel of my work and what I do. It's the way I get my news, stay in contact with tracking packages, etc. It's my primary personal interaction medium. And when it's down, I'm disconnected.

I don't really use the phone all that much. There are probably weeks where I don't make or receive a call at home. I need it for emergencies, but that's about it. I don't know of anyone that uses US mail to send me anything anymore. It's just not done. I know people that start their day with the Wall Street Journal, and if they don't have it, there's a serious feeling of loss of information.

So I don't read papers, talk on the phone, or mail stuff. I do all these activities on the computer: RSS feeds, IM, email... it's my morning routine. Except for days like today.

Well... when I get into work I'll be able to get a connection there and then be able to get what I need.

UPDATE: it's just come back up at 3:52 am... OK, let's get what we need and head to the train.

UPDATE: a minute later it's down again. Grrrr....

[9:25 am] UPDATE: still down. I've gotten a call from the house saying the internet is down, and I said "Yup, it's Comcast". It's still down, and I now wish I'd moved to git from CVS as I'd have what I needed on my laptop. It's not horrible, but it's annoying, and getting more so. I want the line back up.

[1:00 pm] UPDATE: Liza called and it was back up. Hope it stays up.

Making Great Progress on the BKit XY Line Graph

December 8th, 2008

comboGraph.png

One of the types of graphs that we have wanted to make available in BKit with VantagePoint is the true x-y line graph. Currently, the line graph assumes that all x-coordinates are shared across all data sets and that they are uniformly increasing. This means that there's no way to really properly display a step function... or anything that might "double back" on itself like a hysteresis loop.

A while back, I asked Gordon at VantagePoint if there weren't some way to do this, and if not, could it be added? He responded that yes, indeed, there was - the TowDimCrossScatterViewer. Basically, it's meant to be able to plot multiple scatter graphs where each set of points is a data set. But if you go in afterwards to the data points and tell them to connect the dots, you can actually get a graph. Like this: (sort of)

Fullsize XY Line Graph - Almost

The problem here is that I'm trying to display the square wave on the secondary axis, which was Y in the previous graphs, but it now seems to be X, and that's not really what we're going for. So it's close, but I still need to ask Gordon what I need to do to get the secondary axis to be the secondary Y axis. We'll see what he says, but it's getting really close. Exciting stuff.

It's exciting to see that there is clearly the new ability to create non-functional representations. This has been something that I really wished we had had a long time ago. Well... better late than never.