MapReduce sends every intermediate key to one reducer. A hot key can therefore overload one reducer even when the number of reducers is large.
Design ReducerLoadAnalyzer(int reducerCount) with:
int[] loads(String[] keys, int[] weights), returning total weight per reducer.int hotReducer(String[] keys, int[] weights), returning the lowest-index reducer with maximum load.
Hash every key with unsigned 32-bit arithmetic:
Example 1:
Example 2:
Constraints
1 <= reducerCount <= 1000 <= keys.length <= 10^4keys.length == weights.length- Keys contain ASCII letters and digits.
0 <= weights[i] <= 10^6- Every reducer load fits in a signed 32-bit integer.