GeekFactory

int128.hatenablog.com

appengine-mapreduce-javaにおけるShardingの制限事項

appengine-mapreduce-javaで並列度が上がらないから変だと思っていたら、ユーザガイドに以下の記述がありました。

Sharding is currently done by splitting the space of keys lexicographically. For instance, suppose you have the keys 'a', 'ab', 'ac', and 'e' and you request two splits. The framework will find that the first key is 'a' and the last key is 'e'. 'a' is the first letter and 'e' is the fifth, so the middle is 'c'. Therefore, the two splits are ['a'...'c') and ['c'...), with the first split containing 'a', 'ab', and 'ac', and the last split only containing 'e'.

UserGuideJava - appengine-mapreduce - User guide for Java MapReduce library - Google App Engine API for running MapReduce jobs - Google Project Hosting

分割にキー(おそらくdecodeされたキー文字列)を使用するため、先頭が似たキーは同じシャードに入るようです。並列度はキーの分散に依存するということでしょうか。

キーはいくつかの列を連結して生成しているので、連結の順序を変える必要がありそうです。キーの分散を大きくすると、BigTable空間での分散も大きくなって良かったりするのかな?

ちなみに、PythonのユーザガイドにはShardingアルゴリズムに関する記述はありませんでした。