I am looking to create URL shortening service for a project. This will be a very basic service that requires storing the following:
- A random 6 character (
[a-z][A-Z][0-9]
) short string (unique). The id/key. - The long URL. The value.
I have chosen to use Azure Table Storage for this service since it works with our stack.
When a request comes in with the short string (key), I simply need to look up the entity and return the long URL (value).
This is just basic key/value storage. Since ATS requires a partition AND row key to define an entity, I am trying to think of the best strategy for partition and row keys.
So far I have come up with the following options:
- Use the short string as the partition key. Empty (no) row key.
- Use the first letter of the short string to define the partition, then use the remaining 5 characters as the row key. This creates a maximum number of 62 partitions that would theoretically distribute the entities evenly across all the partitions.
- Are either of these two approaches a good idea?
- What are the pros and cons of each?
- Is there a better approach for simple key/value pair storage?