Tuesday, August 26, 2008

gem update taking forever: the solution

I've been running into this little problem for a long time: gem update takes slightly longer than forever. I've Googled around a bit, and it seems I'm not the only one suffering.

One of the posts I read about this, mentioned that gem is a piece of **** and tries to load the whole of rubyforge.net into memory, which fails and / or takes forever on low memory machines. I know this to be true, because my old laptop (an HP Omnibook XE3 with 256MB), which I use as a server, has serious trouble updating my Rails gems. When I installed this machine with the server version of Ubuntu Hardy, I did what I usually do: the swap I created was twice as big as the RAM, so it has 512MB of RAM.

For updating gems, this seems to be too little. Yes, that made me cry too.

Adding more swap was not that easy, because I used up the entire disk for other stuff. Omnibooks don't have much diskspace. What to do, what do to?

Enter nbd. NBD allows me to share a swapfile from my desktop, which is then used as swapspace on my server. I can verify this works, because my server is updating it's gems as we speak, with a swapfile used over nbd. Pretty cool.

Is this hard to set up? Not at all.

First, we create a swapfile of about on the computer we want to share swapspace from. Do this with

$ dd if=/dev/zero of=/tmp/swapfile bs=1024k count=1024

The swapfile is now in /tmp. Then we make it a swapfile by running

$ chmod 777 /tmp/swapfile
$ mkswap /tmp/swapfile

Now, just install nbd-server and modprobe nbd on the computer you wish to share a swapfile from. On my computer, running an Intrepid Alpha, nbd-server did not create a stub configuration file during install. If there is no configuration file, nbd-server will not start. Just run

$ sudo dpkg-reconfigure nbd-server

to create on and use some sensible values, like pointing it to the file we just created.

Next, on the client, install the nbd-client package, modprobe nbd and run

$ sudo dpkg-reconfigure nbd-clent

as necessary, using the same sensible values. Tell it to use the nbd as swapspace.

Last, run

$ sudo gem update

succesfully :-)

Of course, if you have oodles of diskspace left, you can also create a local swapfile and use that. I didn't because a) I have no spare diskspace on the server and b) always prefer the over-engineered solution.

1) The way I set up nbd above is insecure. Please keep this in mind. I am only using this for a gem update, so for me, this is not a problem. If you plan to use the nbd permanently, please, use a more secure setup.
2) I'm honestly not sure whether all the steps in the creation of the swapfile are necessary. I copied some of this from a tutorial on ubuntuforums about nbd. Credit to the poster of this thread.

This should be added to Google Docs!

A long time ago (so long ago actually, the original post has disappeared during one of my changes of blogging service), I predicted that Google would take over this small startup that offered online make of Powerpoint-like presentations and put that stuff into Google Docs. (I can't even remember the name of the service: it's *that* long ago ;-))

Google eventually built it's own presentation software into Google Docs, but still it's a half win for me: they did add presentation software to Google Docs.

I'd like to offer another small prediction today, be it with a little less bravado. I'd like to predict Google will eventually either build or take over a concept similar to this. It's obviously bloody brilliant and very useful, whether you use it alone or in a group.

Friday, August 15, 2008

I really want a Jaiku invite

Omg. Since Twitter kinda sucks in more than one way (importing contacts is hell, outages, errors, etc.), I have trying to find a Jaiku invite somewhere, which is next to impossible. I really want one.

People claiming to have had Jaiku invites are all out of them now, the Jaikuinvites website seems all but dead (and not sending out invites in any way) and submitting your email address at Jaiku.com doesn't help either.

Jaiku was aqcuired by Google in late '07. It's now (almost) late '08. Jaiku is still invite-only and still not "assimilated" by Google like Writely was converted to Google Docs.

There was some talk about Jaiku being a 20% project at Google, which wouldn't surprise me seen the pace with which Jaiku seems to be evolving... Who knows, maybe Google silently killed off Jaiku...

Anyway, if you have some Jaiku invites to spare, please send me one :-) I'd like to convince myself it's not a dead service (yet)!

Update: flabbergasted... Less than a two hours after posting this, I received an invite and am now on Jaiku. Don't start spamming me for invites just yet: I haven't gotten any... Happy to be on Jaiku though :-)