Re:Show HN: A simple url shortener written in Node
by dtreacy on Wednesday September 21, 2011 @05:07AM
(#3021289)
Good point. Yes, in theory they could be duplicated. I chose 6 characters firstly to keep the url as short as possible (I thought 5 chars was too short, 7 too long).
I am planning on introducing a background process to clean up shortened URL's that haven't been accessed in a given time frame (still deciding but I think around 7 days). While it still wouldn't solve the problem you mentioned at a certain scale, it would help. But true, I very much doubt it will ever reach that scale.
Thanks for the critique
With a hex hash at 6 chars, there are a possible 16,777,216 unique URLs (Probably not an issue, unless you're bit.ly). But when there have been 1,677,721 URLs generated, there is a 10% chance a URL will be duplicated, at 8,388,608 there is a 50% chance, and so on. While those numbers are very high and probably not an issue, it's worth considering this probably wouldn't work on a large scale (Though I'm sure it wasn't designed too)
Not really a criticism, I still think this is a great example of how simple Node is, just an observation