KVM provides full virtualization under Linux

Open Source just keeps getting better and better.

Been messing around with alternatives to VMWares ESX and ESXi. Of the top contender thus far is KVM.

KVM is a true kernel-level hypervisor similar to ESXi. Unlike ESXi, you still load a typical Linux OS first – the KVM runs via a special kernel module.

At first glance, I was a bit confused: you install Qemu and KVM. “So is this Qemu or is it KVM”. It is actually both. KVM is largely comprised of two components: the kernel-level hypervisor and a handfull of shared libraries and binaries shared by Qemu.

At the core, you call the “kvm” command just as you would call the “qemu” command (they take the same arguments).

Installation on Ubuntu is easy-squeezy:

apt-get install kvm qemu

Currently, kvm supports all the neato stuff you would expect from a kick-ass virtualizer:

  • Full virtualization that takes advantage of VTI and AMD-V extensions
  • Supports snapshots and machine states
  • Live migration of a running guest from one server to another
  • Multi-processor support (up to 64 I believe)
  • Good memory management with Windows guests

There are some GUI tools for managing the virtual machines – one of the neatest I found was virtual-manager. Similar to VMWares VCenter. I have not used this tool much however in favor of custom scripts for management.

Looks like I will be deploying this in an initial test phase at our TeirII data center in Franklin, TN for the Army National Guards website (http://www.nationalguard.com). I will keep everyone posted on how the tests turn out!

New real-time Analytics-like logging system

So the company I work for is considering spending over $20,000 on a new web analytics software. Out of the list of packages are Omniture, CoreMetrics, and WebTrends.

It is amazing that this is a niche that has not really been filled via open source offerings.. yet.

Say hello to PG::Stats.

Okay, okay… so this is NOT a finished work of art yet. But I have started a large portion of it thus far. In fact, I currently have:

  • A standalone high-performance customized web server daemon for the data push API
  • A single perl module for the actual data insertion
  • A near-finalized table structure.

The system is written purely in Perl. Theres a front-end I currently have styled and sketched out using the Catalyst framework but nothing functional on that end.

The database is Postgres (as apposed to MySQL) because:

  • Postgres supports Table partitions and proper inheritance.
  • Postgres has nifty data-type such as IP Address types
  • MySQL is now owned by Oracle – need I say more?

I have been thinking of turning this into a GPL’d application and setting up a subversion project on my server if enough people would be interested.

Gimme a shout at dean@supergluetech.com

Good regex for parsing apache CommonLog format

Been working on a custom real-time logging system (kinda like Analytics) in Perl. Anywho, this is not the first time I have needed to parse through an Apache web log to mine some sort of data out and I figured I would share the regex to get the job done.

/^(\S+) (\S+) (\S+) \[([^\]\[]+)\] \"([^"]*)\" (\S+) (\S+) \"?([^"]*)\"? \"([^"]*)\"/o

Now this works fine in Perl and PHP, but I image it should be fine with any language that handles PCRE.

Heres a perl snipplet of how to capture the sub-patterns:

my (
	$remote_ip,
	$rfc931,
	$authuser,
	$date_time,
	$request,
	$status,
	$bytes,
	$referer,
	$user_agent
) = ( $1, $2, $3, $4, $5, $6, $7, $8, $9 );
my ( $method, $url, $protocol ) = qw( - - - );
if( $request =~ /([a-zA-Z]*)\s(\S+)\s(HTTP\/1\.[01])/ ) {
     ( $method, $url, $protocol ) = ( $1, $2, $3 );
}

Hope that helps!

Cookeville.com – wtf?

Now I really hate to bash and/or rag on poorly designed web sites, but this one takes the cake. And not only because of poor design, but partly due to the fact that it is run by a media/marketing company (whoes primary business it business image and whatnot).

Check out http://www.cookeville.com

Things that just stick out at first glance:

  1. Horrible jpeg image that is severely pixeled and looks as though it was spliced together with Microsoft Paint.
  2. “If Viewing in I.E. 8 Use Compatibility View” – this is unacceptable for any serious production (read: well designed/tested) site.
  3. Almost complete lack of spacing between text and page elements – both on page copy and main site links.
  4. A right column cluttered with ads that have text so tiny you can not read them.

This entire site reminds me of the days of poorly hacked up Front Page sites of the 90’s.

Digging into the site reveals an extremely un-polished user experience. Now, I ain’t just saying this because I do web design myself, in fact heres some others locally that [as far as I have seen thus far] perform some outstanding web design:

  1. http://www.one7media.com/
  2. http://www.cookevillecomputers.com/ <– Pretty damn impressive for a “computer fix-it shop”
  3. http://www.eyeblastmedia.com/
  4. http://www.mmacreative.com/ <– A favorite, really clean

Cookeville.com: if you are reading this, please contact one of the people above (or somebody) to get things up to 21st century web standards!

Simple round function for Perl

Heres a usefull round function for Perl:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
sub round {
	my @number = split /\./, shift;
	my $precision = shift || 0;
	return $number[0] if ! $number[1];
	my $decimal = $number[1];
	if(length ($decimal+0) < ($precision+0)) {
		return $number[0].".".$number[1];
	}
	my $rounder = substr $number[1], $precision, 1;
	if(($precision + 0) == 0) {
		if(($rounder + 0) >= 5) {
			return $number[0]+1;
		}
		return $number[0];
	}
	my $base = $number[0].'.'.substr $number[1], 0, $precision + 0;
	if(($rounder + 0) >= 5) {
		my $rounded = '.'.('0' x ($precision - 1)).'1';
		return $base + $rounded;
	}
	return $base;
}

Usage is simple:

round( $number, $precision );

The featured post is HERE