Oct 172013
 

With apologies to all drunken sailors who will no doubt resent – quite reasonably – being compared with a dysfunctional government.

The big news today (and yesterday – different time zones confuse these things) is that the US government has grasped just a bit of sanity and has stepped back from the abyss. Well most of them did, but the lunatic fringe of the Republican party (also known as the Tea Party) still persisted in trying to block the government from doing any work and paying any debts it owes.

But it is only temporary, and unless some more sanity returns to US politicians, we will get to see this mess repeated in January.

Ultimately this is all the fault of a fanatic wing of the Republican party who believe it is their right to undemocratically block the government budget until their favourite hobby horse is taken care of. Obamacare. Whether it is a good or a bad thing, it is a done deal, and it is undemocratic to try to sabotage it without first giving it a chance.

Yes the US has too much public debt, but too much is made of the so-call US ‘debt crisis’. The overall figure is immense to be true – so big that it is impossible to understand; so big that we have clever means to make it understandable, and to understand it in terms of affordability. If you look at the US debt as a proportion of GDP (in other words how affordable it is), you will see that the US is in 35th position (according to CIA figures) with a figure of 73.6% of GDP. Or 9th position (using the IMF figures).

Not a good position certainly, but hardly a basket case.

Now there’s a great deal of sense in reducing US government debt, but not in this way. Simply by stopping US government cheques would cause a catastrophic effect on the US (and world) economies.

Perhaps those with a vote in the US would like to remember this when it comes to voting next time. Your current set of politicians look dangerously dysfunctional; even in comparison to politicians in other countries.

Oct 132013
 

I discovered this cool feature of Linux quite by accident. zRAM is a block device (i.e. a “disk”) where the contents are compressed and stored in memory, which makes it sound rather mundane and hardly very interesting. However in use, it does appear to be quite nifty; sufficiently so that Google are enabling it for Chrome OS. So why?

The way that it is usually configured is as a swap space … so in effect, zRAM is used to compress normal memory, trading processor utilisation for more memory. What should happen is that instead of hitting the performance brick wall of suddenly paging to disk when you hit the memory limits of your machine, the zRAM is used instead eating a bit of processor time but with any luck keeping everything within memory rather than going to disk. It should have no effect during normal operation, but during temporary surges of memory utilisation, it should allow things to proceed at more or less normal performance.

That’s the theory anyway; but if it were not the case would Google be enabling it by default?

Of course in addition to using it as a swap device, there are other possible uses for zRAM devices :-

  1. As an L2ARC cache device for those using ZFS.
  2. To use as a block device for very hot disk spots in examples such as Exim’s retry database – which can be safely discarded on reboot.
  3. Or any other cache whose contents can be safely discarded at any point.

The last point is worth remembering. Because zRAM devices are contained within main memory, their contents are discarded when the power goes away.

Configuration

To use zRAM, we need to load the zRAM module, and choose how many devices to make at the same time. Some people believe that it makes sense to create as many devices as you have cores, as that gives each core (or thread) a device to spend it’s time compressing. To do this, we add the following to the /etc/rc.local file (assuming a Debian system) :-

/sbin/modprobe zram zram_num_devices=$(cat /proc/cpuinfo | grep processor | wc -l)

By default the zRAM will allocate 25% of the main memory to all of the zRAM devices; personally I think that is reasonable enough. However it seems that as soon as you set the number of devices, the size defaults to zero … so we have to set the size of the device as we configure it. Once created, you will have to decide how to use the devices. In my case, I wanted to use half of the devices for swap and half for L2ARC, which I did by adding the following to /etc/rc.local :-

size=$(( ($(cat /proc/meminfo | awk '/^MemTotal/ {print $2}')*1024) / (4 * $(cat /proc/cpuinfo| grep "^processor" | wc -l)) ))
#       Complex way of determining the size of each zRAM device
for dev in /dev/zram*
do
  base=$(basename $dev)
  echo $size > /sys/block/${base}/disksize
  odd=$(( $(echo $dev | sed -e "s/^.*zram//") % 2 ))
  if [ $odd = 0 ]
  then
    /sbin/mkswap $dev
    /sbin/swapon -p 32767 $dev
  else
    zpool remove pool0 $dev > /dev/null 2>&1
    zpool add pool0 cache $dev
  fi
done

This is a rather complex way of doing it, and doesn’t contain much in the way of error checking, but it does work.

Oct 122013
 

Sometimes people get amused when they see my blog’s tag line (“Grumbles from the Growlery”), because they get the word “growlery” confused with the word “growler”. Just to show this isn’t that sort of blog, I’m going to define it.

It’s a room for growling in; nothing more and nothing less. See “Bleak House” by Charles Dickins which has: “This, you must know, is the growlery. When I am out of humour, I come and growl here.”.

Other definitions come from :-

  1. The Collins dictionary: “a place to retreat to, alone, when ill-humoured”.
  2. The Phrontistery list of unusual words (you have to scroll down): “a retreat for times of ill humour”.

And you can probably find many other definitions yourself.

The Growlery

The Growlery

 

Oct 122013
 

If we are getting to the stage that autonomous vehicles can drive themselves – probably safer than most human drivers – do we need to think about whether a human driver is necessary at all? Although there are people who enjoy driving, not everyone does and even those who do may not enjoy it all the time.

Why bother with a driving license if you can get a robot driver to do all your driving for you?