Short URL’s

Microblogging makes this important. There are a bunch, but I prefer because its five characters long.


Other’s I’ve found and used include

A number of people publish top 10 lists, you can use google to find them.

Problem definition

I am interested in writing or implementing a url-shortener, for use inside the firewall, or implementing through an API. It seems quite simple until you consider performance at scale. My first thought was to use a database with an identifier/sequence data type as the key to the hashing algorithm, since its best to keep a record of the URL’s issued so if people ask twice for the same url it can be reused.

The second part is resolving the URL on request. Is this just an apache solution with a very large redirect file?

Some research

I used google: url shortner howto, to see what it came up with.

Two interesting finds included


Idea No 1 was to use a database identifier type and hash it, I was going to investigate if we could use a web server redirection file, or if I’d have to write something using a db retrieval. However both these the database transactions introduce serial bottlenecks and inhibit scalability.

So can pre-allocate the sh.urls in blocks , and allocate them using hadoop? Is hadoop a sensible solution for “find me next unused”, or perhaps it doesn’t matter; its just find me one unused slot?


Glassfish was Sun’s open source application server. Here are my notes on trying to get it work. I didn’t succeed, and I think it’s gone now. I got stuck because I wanted to use Ubuntu’s repo and the start/stop scripts were borfed. I expect all the Sun links are also broken.


I have installed it on an Ubuntu 8.04 Virtual Box Image.

I have a problem here, there is a script asadmin in /usr/bin, which looks broken to me. I’d be surprised if I were the first person to find it, but I have not created an automatic service start/stop yet; this script overwrites my bespoke configuration parameters. The script points to another script called the same in /usr/share/glassfishv2/bin, which is the Sun Version. I shall investigate this problem and also possibly why the rc.glassfish files aren’t part of the package.

I’ll write it up some more later.

  • Use synaptic to download glassfish
  • asadmin is in the /usr/bin


  • create a system user
  • create a directory, chmod 777
  • sudo start

To be done

  • rc.script and integrate into service management, that’s why I looked up bum.


I had some help

  • Jasper Kalkers blogged about it emphasising how to run it in a non root user. He didn’t use the package manager and so the stuff about building is not necessary, nor was downloading Java, I already have that.
  • Andrew Spooner’s Blog, pointed at by Jasper as his inspiration.

Both were written before Glassfish made it to the Ubuntu apt repositories or they don’t like it, however Jasper refers to apt-get to get Java.

I read up some of the sun documents, which I’ll link another time.


I have posted on Sun’s forum to try and find out the best communitarian behaviour and to see if anyone else has come across the problem. It seems most people use the Sun install process not APT. The thread link is Glassfish on Ubuntu 8.04, /usr/bin/asadmin. I also looked at Ubuntu’s forums, and searched on “Glassfish” in the “Install & Upgrade” forum. There were two threads both dated around May 2008, which generated Java exceptions. I have had my app server running so I don’t think these apply.The answer to one was to re-install using the Sun Installer; they had a Net Beans integration problem, and the other was trying to use Open JDK, and was advised to use Sun’s. 3rd March 2009