performancedigital-oceanuuidreasoning

Why does DigitalOcean use uuid for user id and integers for Droplet id?


I'm building a REST-API and while I was researching for what id type to give certain objects I saw the DigitalOcean API Documentation.

The objects: volume, volume snapshot, certificate, domain, firewall and load balancer are all having a string uuid.

The objects: action, domain record, droplet, droplet snapshot, droplet kernel, droplet backup, droplet neighbor, image and SSH key have a integer id. But Droplets have an unique integer id.

What are the intentions of using integer ids or string ids in the situations of each object?

The only thing I thought off, DigitalOcean had used string ids in the early years couldn't just switch all string ids to integer ids.

Or

All objects which are short-lived or being created a massively often have a integer id for performance reasons and objects with string ids are like the opposite, long-lived and created less often.

I've made two tables to see better which objects have a string/integer id.


Solution

  • At DigitalOcean, we have standardized on using string uuids going forward. One of the main motivations was that primary keys tie are tied to a specific datastore implementation and can make architecture refactoring more difficult. So the resources using integer IDs are doing so for backwards compatibility and have simply been around longer (i.e. our Droplets were our first product while things like Load Balancers and Firewalls are more recent additions).

    Full disclosure: Among other things, I maintain DigitalOcean's API documentation.