TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: opensource solution for URL shorter?

2 点作者 jacktang将近 16 年前
I always want to know what's the challenge of shorting long URL.

2 条评论

digamber_kamat将近 16 年前
Since you just want to know the challenges and are not really concerned about "whether url shortening is a good thing" I will put one challenge here. I am sure there will be many more.<p>At a higher level there is nothing difficult. you have to only maintain a table with shortened code to actual url mapping and then use HTTP redirection requests to redirect the URL. But what should be the length of that shortened code ? Should it be fixed or variable ? How do you generate that shortened code? Can the same URL have different codes? Should we generate the code based on some hash stuff (in such a case looking up for duplicates will be simple) or should we just increment the last generated code ?<p>Once this is done let us say we create a table in mysql with code =&#62; URL mapping. The able type is MyISAM which supports only table level locking<p>If there happen to more writes on table than reads. The read operation becomes slow. Hence the table type needs to be InnoDB which supports row level locking.<p>These issues might be corner issues but they do exist and sometimes they can matter as well.
评论 #680566 未加载
dotcoma将近 16 年前
is it something interesting to do for a hacker?<p>who pays the bandwidth bills?<p>what do you get out of it?