I have some groovy code which basically populates a map and then some code later on which gets the value out of a map.
The keys are strings. Should be simple right?
The problem is that is you use groovy's excellent string facilities (i.e. "this is a string with a ${parameter}") then no, you don't have a java.lang.String you get a org.....GStringImpl.
The code that was inserting into the map was using this feature, the code that was retrieving it was using a plain java.lang.String. The solution was to cast the key to a string (actually no need to cast; String s = "this is a string with a ${parameter}" works fine).
Stupid that GStringImpl.equals doesn't take this into account.....
Tuesday, 2 March 2010
Thursday, 11 February 2010
Running pveperf from Proxmox on any distribution
So in the quest to solve the mystery of why my 4x300GB 15k SAS disks are behaving like a dog I turned up a number of interesting resources. One of which was possibly a dodgy kernel driver.
So, off I go and install CentOS (aka poor man's RedHat) - if they don't support it properly then no-one will and I naturally typed 'pveperf'. pveperf is a lightweight performance profile tool that comes with Proxmox. Unfortunately it only comes with proxmox.
Unfortunately, it is the quickest way I know of how to find out the number of FSYNCS a second the drives will do, and that number is pretty critical for lots of virtual machines that wil be IO bound.
Anyway, turns out, pveperf is written in perl, so getting it working on any other machine is pretty trivial. Instructions here.
So, off I go and install CentOS (aka poor man's RedHat) - if they don't support it properly then no-one will and I naturally typed 'pveperf'. pveperf is a lightweight performance profile tool that comes with Proxmox. Unfortunately it only comes with proxmox.
Unfortunately, it is the quickest way I know of how to find out the number of FSYNCS a second the drives will do, and that number is pretty critical for lots of virtual machines that wil be IO bound.
Anyway, turns out, pveperf is written in perl, so getting it working on any other machine is pretty trivial. Instructions here.
Wednesday, 10 February 2010
Virtualisation - it rocks!/what a nightmare!
I love virtualisation. I hate virtualisation. Arrgggh!!!
I administer our development infrastructure which consists of the usual suspects - ldap server, file server, wiki, jira, source code repo, continuous integration servers etc. Being a small outfit I decided we should do the virtualisation dance. I am no stranger to virtualisation having used it before (on my laptop and in production).
So, my first foray into 'grown up' virtualisation involved using KVM on top of Ubuntu. This worked really well and it is amazing what you can pack into a single Xeon quad core with 8 gigs of RAM :). One minor niggle is that it was roll your own for pretty much everything, including backups. Taking snapshots of the virtual machines using LVM was a doddle, but then mounting those partitions and then tarring up those partitions etc. was a bit of a pain. A few bash scripts later and everything was fine, but it just wasn't reliable enough.
For technical (financial) reasons we had to move to a different hosting company and I noticed they offered Proxmox, a debian based distribution which includes a really nice web app for administering both KVM and OpenVZ containers. It rocks, it really does. Setting up virtual machines was a snitch - backing up was as complicated as ticking a tick box - woot.
After 4 or 5 months of bliss I noticed the CI server was running quite slowly and it turned out that it was Disk IO bound (as you would expect with what is essentially a DB server). So, on investigation I decided to find some nice SAS 15k 300GB disks to play with.
Anyway, new month, new hosting provider and I thought I would take a look at the big boys - XenServer and ESXi. They both insist on a Windows client which was a blessing and a curse - I don't like Windows, but the other guy I have pegged as a substitute SysAdmin really does. Installation on both went fine and I was very impressed. You could feel the big corporate brains behind it. Both are free but offer commercial add-ons. For ESXi you need to pay silly money if you want to manage more than one host, XenServer will let you manage a cluster for free.
So, after installing XenServer using DRAC (this is a Dell r410) I run my hands with glee!
Anyway, first thing I wanted to do was setup the machine that caused the most issues - the database seeder. It really just reads a row, does something in Java, then writes it out to a different database.
So, I installed a Windows 7 VM - both offer PV drivers (for efficiency) for Windows 7. Installation was a breeze, those SAS disks really are a thing of beauty.
Then I installed the updates (gotta love Windows), then SQLServer 2005 express and so on. There are 4 SAS disks in there, two on RAID 1 and two on non-raid. I configured the source OS on RAID, the source DB on one of the non-raid disks and the target DB on the other non-raid disk. Wow, this was going to move!
Finally I had the code base on there and clicked the button to seed. I was holding my breath to watch this thing fly! As a reference, I have Leopard running on a 2007 MacBook Pro. I use VMWare Fusion to run Windows XP with 1.5GB ram. Compiling the application on the laptop VM tales about 400 seconds. Compiling on this beast takes less than a 100. Woot. This is going to be *great*!
So I click the button to start the seeder - the first part scans the entire source database to make sure it is sane. Wow - that absolutely flew by. Amazing. Then it started to write to the new database. Every so many seconds it prints out how many rows it has written. It prints 300, 650, 900, 1400. 'Hmm', I think, 'I am sure the VM on the laptop is faster than this!' so I check - and yep, indeed - the laptop VM prints out '1300, 1500, 3740, 6010' (the second number is an anomaly, but hey). Eh? What?!?
So I start the entire process again, and yep, same behaviour. In the end I run both seeders at the same time (within seconds whilst I move the mouse). The VM on the new machine absolutely flew by through the sanity check and started writing minutes before the laptop VM. However, once the laptop started writing it soon caught up and left the new VM in its dust!
After pulling my hair out many many times and reading *the whole web* I decided to try Windows 2008 as that supposedly understand how to be a virtual citizen slightly better than Windows7. Same thing. Admittedly the performance of Windows2008 was better, almost 75% faster writing than Windows 7, but still no where near my silly little laptop.
Hmmm I think. I try a windows 7 install without installing the xen-tools (which installs drivers for paravirtualisation) and unbelievably the performance without the go-faster stripes is faster than with! Only about 20%, and still nowhere near the laptop performance, but this is insane. Some more googling beings up this and this (my post).
Bugger this, I think to myself. Fire up the remote console using DRAC and install ESXi. Installation was a dream. Install the vSphere client on my now rather infamous VM on my laptop (sigh).
Install Windows 7.... and blow me if it isn't exactly the same behaviour. Same speedy performance on reading, terrible performance on writing to a database. At least installing the PV drivers didn't slow it down, but it didn't help either.
On both XenServer and ESXi I tried a simple copy of a 600MB CD image which took about 15 seconds (in the VM) - on my lappy it takes many many minutes. The SAS disks *are* working for large sequential reads and writes, but lots of small writes (as evidenced by the database inserts) seems to bring it to its knees. I posted on the ESXi forums, but no help there yet.
Unfortunately, Debian, and therefore Proxmox does not work on this machine because they get confused about the order of the devices - they install fine but after reboot the disks cannot be found. Nice. (forum post).
So, what now? I am not sure. I get that virtualisation has a performance cost, but please don't expect me to believe that a VM on my bog standard laptop, with their infamously slow disks will perform better than a commercial class virtualisation tool. In fact I know the new disks work - copying the CD takes hardly any time at all (either on the host or in the VM).
Three days with hardly any sleep, 15 installations of Windows VMs, 4 installations of virtualisation products, 3 failed Linux installs (Debian, Proxmox and CentOS) later I am thinking 'I don't really care anymore'.
Next step will be to speak to the hosting providers - they have been really really helpful, but I can't expect them to support third party software - and ask them to take out the RAID card giving me 4 SAS disks, see if that helps.
Sigh.
Monday, 25 January 2010
Update on martial arts
Been a while, so I thought I would update.
I have withdrawn from Tae Kwon Do due to scheduling conflicts - my church home group now meets on a Friday night and Saturday mornings are taken up taking one of the kids swimming).
My new regime is:
- Monday - Jiu Jitsu (7.00-9.00)
- Tuesday - Thai Kickboxing and Jeet Kune Do (6.00-8.00)
- Thursday - Thai Kickboxing (6.00-7.00)
- Saturday - Thai Kickboxing and Jeet Kune Do (11.00-1.00)
Wanting to commit to Jitsu (their particular theme of Jiu Jitsu) suprised me somewhat, but it is actually turning into a lot of fun!
I am however, gutted about not making TKD, but so be it. Church has to come first - priorities and all that.
I am going to do this as faithfully as I can for the next month or so, after which my fitness at least will have improved. At the moment I really do look like a whale on ice, but hey - it is all fun and nobody has yet poked fun at me :) - they are all a great bunch.
So, onwards and upwards!
Tuesday, 12 January 2010
Another Ju Jitsu review
(Continuing my journey to become a martial artist)
My minister at the church I go to mentioned that our drummer was a Ju Jitsu teacher. I know I had tried it before and wasn't exactly on fire, but I have always liked the idea. If I could skip forward 4 or 5 years to when I receive my black belt I would be over the moon. But I can't, and I don't know that the journey has enough pace for my enthusiastic puppy-dog attitude. I also can't get away with being a big bloke - technique is king :)
Anyway, I went to their 2 hour class (http://www.jitsufoundation.org/jujitsu.asp?page=jujitsu_club&clubid=Leicester_Jitsu_Club) yesterday (instead of a kick boxing session with urbanmartialarts.com) and I was pleasantly surprised.
We met in St Matthews Center in Leicester in a generic rented room which temporary mats put down.
There were only four other students (blue, orange and white and another beginner), which made the class quite intimate. The class started with a blue belt taking us through a warm up which was fun, but after which I was utterly knackered. 18 odd stone has a lot of kinetic energy! Oil tankers are not designed to change direction at speed :)
Anyway, the class started with the usual ritual of saluting the instruction (bowing), who is a 1st Dan black belt. The white belt and myself were then led through left and right break falls and forward and backward roles. I used to be able to do this without thinking - now I couldn't do the back roles at all :( Very disappointing.
After that we came back together and the instructor demonstrated some escapes from a knife attack from behind. I am always sceptical about whether this would really work - wouldn't you just wet yourself? :) Anyway, the technique was effective and it was explained and demonstrated well. We then split into pairs (or threes as there was an odd number) and took turns.
The level of instruction was nice - enough to make progress, but not too much so there were 49 things you were trying to think about. I felt I picked up things quickly, which was nice. I was encouraged that the instructor never had to tell me the same thing twice. Actually, that is a lie. I *always* get told to bend my knees and not my back. At around 6 foot 2 inches this is a persistent issue I have.
So, the ever present question - will I continue. I am in two minds. It was good fun, hard enough to be interesting but in a nice relaxed environment. The instructor was also adamant that they do 'more than just the locks and throws' and they do cover strikes, which is my nagging issue with the 'softer' arts. The problem is I only have 6 hours (3 nights) *at most* to train and I really want to do the other two (TKD and JKD). TKD for the fitness and patterns, JKD for the effectiveness/therapeutic semi-contact sparring. A dilema.
If I could jump into the future, I would cherish a black belt in Ju Jitsu, TKD and then JKD in that order, I just don't know if I can commit to 4 or 5 years of Ju Jitsu training. Does that make any sense?
I could go to one of each class each week (Mondays JJ, Tuesday TKD, JDK any other day) but that might be spreading myself too thin.
Arrgggh, what to do?
Anyway, pros and cons of this class:
Pros:
- effective and accurate teaching
- it is true what they say about JJ - belts there are higher than equivalent belts in other arts
- nice social aspect to it
- level of detail was great
- investment in this class would pay dividends
Cons:
- probably the least effective at increasing fitness - not a biggie, but to be noted
- I have *no* flexibility in my joints. I felt pain watching other people's locks :)
- going here removes a class from TKD and JKD making it very expensive
- grading is 3 monthly - although I am not sure I will progress faster
- do I really want to do this class? I think I do....
Oh, the indecisive mind :(
Friday, 8 January 2010
Review of Sahota's Taekwon-Do class
(Continuing my journey to become a martial artist)
Unfortunately, due to technical reasons (the sprinkler system from the floor above!) I couldn't go to my kickboxing at the excellent http://urbanmartialarts.com so Wednesday and yesterday were pleasant days off.
Today, I went for an introductory class and then stayed on for the beginners class at Master Sahota's Taekwon-do class.
It is in a very large room in a commercial building. The room is dedicated to that class and has semi-permanent mats laid out with a fair number of target and power bags around the outside of the room. Good enough.
I arrived for a 1-on-1 assessment with Master Sahota's son, who tells me he has been doing this for over twenty years. I can believe it - I was impressed both with his teaching abilities and the control he demonstrated over his body whilst performing various moves.
During the assessment he would show me various things and ask me to repeat them - stances, walks, punches and kicks. All fairly low grade things that I would have breezed through a few years ago, but I actually found quite hard to do right. Right from the beginning it was clear that these guys teach a strict martial art. The instruction was an almost constant stream of 'relax your shoulders', 'slow start/fast execution', 'don't forget to twist at the end', 'remember to breath in, hold it and release on execution'... you get the idea. A world apart from other clubs which were basically 'hit this pad 30 times and then swap' :)
And, for me, it was a breath of fresh air. They explained how some of the black belts I had previously trained with popped in once and were informed that they would be graded considerably lower. I can understand it.
Don't get me wrong - it was great fun, quite light hearted and very relaxed. But make no mistake - they are there to teach you a specific branch of a particular martial art (TKD).
After the assessment (during which I managed to rip my track suit bottoms from mid-thigh to mid-thigh - nice!) I was invited to stay on to the next class - the beginners class.
This was more of the same - practicing individual techniques as a class. Again, the instruction was consistent and just the right level of detail. At the end we did non-contact sparing, which I had always turned my nose up, but actually it was pretty hard!
Am I going to go back there - almost definitely! I have had enough of going to places where you primarily pummel a pad or a person and if you have good technique, great. I am fed up of having to ask the instructor 'am I doing this right' or 'should I have my knee like this or more tilted over' just to receive the response 'don't worry about - you are doing fine'.
My heart is divided between this place and http://urbanmartialarts.com. I like this place because it primarily teaches technique, and teaches it well, but I do miss the therapeutic effect of laying into pads or kicking people 8 foot across the room onto their backsides after they hold the bag :) Not that I could do *that* anymore. I suspect, if time and money are permitting I might go to both - this place 2 or 3 times a week and urbanmartialarts.com once a week, just for 'light relief'. Don't get me wrong - I am not in anyway implying that UMA.com is any less technique orientated or less serious, it is however, I think, less formal. Maybe that is unfair as well - they are two sides of the same coin which I think is my currency (how cheesy).
A one sentence summary: 'a proper martial arts school where, if you are serious, could enable you to do some pretty amazing things, but it does require dedication'
Pros:
- cost is pretty good 25/month for 1 lesson or 49(?)/month for 2 or more. All gradings, insurance, association and your first gi are included!!!
- excellent teaching of the art form
- a grade from this place will be transferable, and therefore meaningful
- the main man is a 7th dan and his son (who I met today) has been doing it 20 odd years (no idea about his grade)
- it is a style that I find graceful and elegant
- the higher grades do do sparring
- they are quite renowned for their pattern work - which I like
- I think I could progress here quite quickly
Cons:
- they maybe don't do enough sparring for me (although a weekly dose of UMA.com might satisfy that)
- they make me look like a complete beginner - I almost need to unlearn my previous techniques and start from scratch
- socially it isn't really my scene (mixed kids and adults - nobody my age)
- the beginner class is only 45 minutes long and it will probably take a while before I can join the senior class (if not because of technique then because of fitness, although it will be because of both!)
Subscribe to:
Posts (Atom)