We have an incoming queue of support cases from customers.
Each support case has at least the following fields:
- Case Number (Unique numeric ID)
- Creation Time (Timestamp)
- Title (Text String)
- Description (Text String)
- Other fields...
We'd like to split these into three distinct buckets, in a repeatable way.
For example, the first case that comes in goes to queue A, the second to queue B, the third to queue C etc.
It doesn't necessarily need to be in that order, but the distribution needs to be equal (or close to equal).
The case number is monotonically increasing but they are not sequential (that is, there will be gaps - e.g. case 10005, then case 10400, then case 10405 etc.). The reason is that the case numbers are shared among several categories, but we are only looking at a single specific category of cases.
We don't want to have to maintain a lookup table - but rather I was thinking of generating some kind of hash based on case number + creation time, for example, and then doing a modulus 3 on it?
Question
- Does the above approach look sane? Any comments?
- What sort of hashing algorithm, and on what fields should I do it across, in order to get a good distribution for the modulus?