Today I’ll talk about this very important PostgreSQL server. It was running RedHat Linux 7.x on a dual P3, and a process that sometimes runs there usually took like 17 hours.
There was a spare Dual Xeon laying around, so I decided to replace that old server. Obviously my first choice for a sensitive database server was Debian GNU/Linux, so I installed Debian Sarge to test it: kernel 2.6, PostgreSQL 7.4.6 and scsi drives in software raid-0 (striping) in XFS. Everything was perfect, and the process that took 17 hours in the other box took only 5:30 hours in the new box. A big improvement.
But I am a curious person.
Since there was no hurry to replace that old box (other than the performance since besides the 17 hours process it serves a high-traffic website), I installed FreeBSD 5.3 in that same Dual Xeon.
It was hell.
First, I had some experience with FreeBSD since Aureal System’s server is running it. I have administrator access to the server but I had no experience:
- Installing FreeBSD (this was a piece of cake)
- Making software RAID work (this was HELL)
Now, I have read Michael Lucas’ Absolute BSD and Greg Lehey’s Complete FreeBSD. Lehey’s book has nice chapter about Vinum, FreeBSD’s Raid volume manager (Lehey is vinum’s author after all), but there is a problem with vinum, freebsd5 and SMP (I was installing it in a Dual Xeon remember?). I tried 5.2.1, same problems. Finally it worked with an obscure and undocumented version of vinum called gvinum. The g stands for geom-aware. It worked.
But this was just the beginning.
The beginning of the good news, for me at least. After installing everything and running the previously mentioned process, there was something very hard to believe. In the same box, with the exact same hardware configuration:
Debian+linux 2.6.9 + raid tools + XFS + PostgreSQL 7.4.6 = 5 hours 30 minutes
FreeBSD 5.3 + gvinum + UFS2+S + PostgreSQL 7.4.6 = 44 minutes
Clearly there was something very wrong here.
There wasn’t.
I ran the process again and again and the results were similar. I don’t know exactly if this extraordinary performance gain in this particular process is because of the filesystem or the raid handler, probably it’s because of both. I’ll have to perform some serious benchmarks here, and publish the results of course.
The end of this story is:
- The FreeBSD server is now in production, it runs like a charm and the web pages that access the database now run almost 6 times faster than with the old dual P3.
- I’m installing more FreeBSD boxes.
- I’m reading McKusick’s The Design and Implementation of the FreeBSD Operating System (thanks Breno) and Absolute OpenBSD.
- I am still running debian (unstable) on my desktop boxes, and probably this will not change.
Oh, and I’ll use that SCSI powered dual P3 for my benchmarks, to be published here in a near future.
I just can’t believe I’ve been avoiding BSD so many years.