Monday, November 26, 2007

Self Help

So after not having used the perl module Petal for a few years, I find I'm a bit rusty. Rusty in the software industry means using google a lot to find answers. And when I searched to find how to iterate over an array, and use the array as hash keys or sub keys, I was interested to find a question that I had posted to the Petal mailing list 2 years ago.

Unfortunately, at that time no-one helped me, but I figured it out. Fortunately I posted the answer myself.

Just goes to show how important it is to fill out an answer on a forum/list. How many times can you find people with the same problems as you, but no answers....?

Saturday, November 17, 2007

WRC - Rally Ireland 2007

This year the World Rally Championship came to Ireland for the first time. Last night we set off in a camper van to Magheralough Primary School, near Trillick, Co Tyrone. This is part of the country I'm not very familiar with, but it certainly seems to be a very scenic place.

We arrived last night, parked up and had a poor nights sleep, before the alarm woke us at 7am. After a quick breakfast we ventured outside into the cold to pick out a spot to stand. The roads had been closed at 6am, and were not due to open until 6pm. We managed to get a good place, behind a fence where we could see the cars approach, then come down a small hill, cross the bridge, and then past us.

It turned out to be great, we didn't move a lot for the first stage (stage 12). The stage started at around 9:15am, and cars continued until about 11am. The drivers were clearly timid of the greasy roads, but there was plenty of quality entertainment.

After 3pm another stage (15) was run round the same course. After the first few cars we decided to take a wander up the fields a bit, and found a few other good places to watch the group 'N' and other trailing cars from. We didn't get as wet as expected, fortunately it seemed to rain it all away during lunch, when we were safely inside the motor-home.

All in all a great day.
Other info here :

Monday, November 05, 2007

MySql Performance

After disappointment with how Oracle developer edition runs on my PC I decided to give an old acquaintance a whirl. I downloaded the latest MySql source, and built it in the cygwin environment (using the instructions in the DBD::mysql perl package).

It all installed nicely, and I downloaded TOAD to help set up my tables - another great (and free) tool.

My requirement is a simple lookup, so I set up a simple table, and a perl script to loop and insert values into it. I was reading a bit about optimising inserts, and found that dropping the index before all the inserts, and then adding it again is significantly quicker than keeping it enabled during the inserts.

Then I discovered that it is possible to insert multiple records at once. So I started to play around with this, and made the number of rows inserted at a time a configuration variable. The sql syntax is like "insert into table_name values(?,?,?), (?,?,?)" etc... where there are 3 columns in the table.

Not surprisingly inserting 10 at once rather than one speeded the times up from 2000/sec to 5000 a sec with significantly less trips to the database. Continuing the trend, I discovered that about 10,000 at a time was quite a good number, with around 130,000 inserts per second! Now that's pretty good!

After adding a single index on the 5 parameters I needed to search on, I was able to run well over 1000 queries per second, which is pretty good whenever there is over 11 million records in the database.

Another notable difference using MySql was that there seems to be no slowdown in inserts when the dataset grows.

Friday, November 02, 2007

Malin Head

For some time I have wanted to drive the Inishowen 100, a 100 mile tour round the Inishowen peninsula. Today we set out to drive round it, but we took a couple of shortcuts (i.e. got lost), and instead arrived at "Five Finger Strand", which the kids absolutely adored. There are some great sand hills which they enjoyed descending at great speed.

A fantastic beach, well worth a visit if you're in the area. Apparently we missed the coolest thing though, at low tide you can see the wreck of the Twilight which sank in 1889, on route from Newfoundland to Derry, so we'll have to make a return visit!

The other striking thing about the countryside was the sheer number of animals in the road!

Malin Head itself wasn't too exciting, especially as it was blowing a gale, and my company just wanted to "go home".

On the way home we happened to arrive at Greencastle just in time for the ferry. This gave us a quick route home.