<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vijay Pagare's Diary on Vijay Pagare</title><link>/diary/</link><description>Recent content in Vijay Pagare's Diary on Vijay Pagare</description><generator>Hugo</generator><language>en-US</language><atom:link href="/diary/index.xml" rel="self" type="application/rss+xml"/><item><title>Design: URL Shortener</title><link>/diary/design-url-shortener/</link><pubDate>Mon, 06 Apr 2026 16:27:00 +0530</pubDate><guid>/diary/design-url-shortener/</guid><description>&lt;p>Started learning system design and architecture seriously. I&amp;rsquo;ll be posting daily notes on whatever i learn about the subject going forward. Here&amp;rsquo;s the first one–enjoy!&lt;/p>
&lt;h3 id="1-the-core-base62-encoding">1. The Core: Base62 Encoding&lt;/h3>
&lt;p>To keep URLs short, we use &lt;strong>Base62 encoding&lt;/strong> (&lt;code>[a-z, A-Z, 0-9]&lt;/code>).&lt;/p>
&lt;ul>
&lt;li>A 7-character string gives us &lt;strong>3.5 Trillion combinations&lt;/strong>.&lt;/li>
&lt;li>&lt;strong>Why not Base64?&lt;/strong> Base64 includes &lt;code>+&lt;/code> and &lt;code>/&lt;/code>, which are not URL-safe and can break paths.&lt;/li>
&lt;/ul>
&lt;h3 id="2-the-coordination-problem-key-generation-service-kgs">2. The Coordination Problem: Key Generation Service (KGS)&lt;/h3>
&lt;p>In a distributed system, we must prevent &amp;ldquo;collisions&amp;rdquo; where two servers generate the same ID.&lt;/p></description></item></channel></rss>