title: Short unique IDs
body: <p>I'm designing a HTTP-service, with capacity of up to 500 million requests per day (served by more than one independent machine).</p>
  
  <p>For each request I have to generate unique ID and return it to user. ID must be 100% unique within a window of 10 minutes. (1 day is preferred, globally unique IDs are ideal.) No server-server communication must be needed to generate that ID.</p>
  
  <p>Silly pseudo-session example:</p>
  
  <pre>
  Client: GET /foo
  
  Server: Content-Type: text/xml
  
          &lt;root>
              &lt;id>ab9d1972-2844-11e0-86b2-000c29544403&lt;/id>
              &lt;other_data/>
          &lt;/root>
  </pre>
  
  <p>In previous generation of this HTTP service I used UUIDs.</p>
  
  <p>I'm happy with UUIDs, but there is one problem: they are too long. On that number of requests, this extra size in noticeable in disk space waste for log files.</p>
  
  <p>What is the best way to create a short, but unique identifier? To make things worthwhile, I guess, algorithm should produce at most half of UUID length while being unique for all day long (10 minutes should be even shorter).</p>
  
  <p>Ideally, suggested algorithm would have sane, lightweight production-quality implementation in plain C.</p>
  
  <p>Update: Generated ID should not require URI-encoding when passed in the GET request.</p>