中年engineerの独り言 - crumbjp

LinuxとApacheの憂鬱

MongoDB2.4 リリース(和訳)

MongoDB 2.4 released
を和訳(&少々所感)しました。

和訳

The MongoDB Engineering Team is pleased to announce the release of MongoDB 2.4. This is the latest stable release, following the September 2012 release of MongoDB 2.2. This release contains key new features along with performance improvements and bug fixes. We have outlined some of the key features below. For additional details about the release:

Highlights of MongoDB 2.4 include:

  • Hash-based Sharding
  • Capped Arrays
  • Text Search (Beta)
  • Geospatial Enhancements
  • Faster Counts
  • Working Set Analyzer
  • V8 JavaScript engine
  • Security

MongoDB2.4リリースのアナウンスができる事を喜ばしく思います。
これは2012年9月のMongoDB2.2に続く、最新の安定版リリースです。
このリリースではパフォーマンスに関する重要な機能とバグフィックスが含まれています。
ここではこれ等の機能の概要を説明します。

またリリースに関する詳細は以下を参照してください。

MongoDB2.4 新機能

  • Hash-based Sharding
  • Capped Arrays
  • Text Search (Beta)
  • Geospatial Enhancements
  • Faster Counts
  • Working Set Analyzer
  • V8 JavaScript engine
  • Security
Hash-based Sharding
MongoDB 2.4 adds Hash-based Sharding, built on top of our range based sharding. Using a hashed shard key allows users to get a good distribution of load and data in a simple manner, in cases where documents are accessed randomly through the key space, or if the access patterns may not be totally predictable.
Hash-based Sharding
MongoDB 2.4 では今までの範囲ベースShardingに加えハッシュベースのShardingが追加されました。ハッシュベースshard keyでは、キーに対してランダムなデータアクセスや予測不可能なパターンのアクセスに対しても、効率の良いデータ配置を簡単に実現できます。

ハッシュのランダム性に頼った配置になる。殆どの分散系KVSと同様と考えて良い。
不幸にも偏りが発生してしまった場合でもMongoDBは手動のmove chunkが可能なので対応できる点はKVSより柔軟かもしれない。
ただしトレードオフとして範囲検索などの機能はかなり使い難くなる。
Capped Arrays
Capped arrays declare a fixed size array inside of a document. On a $push operation, users can now specify a $slice modifier, which trims the array to the last N items. You can also specify a sort, which will first sort the array, and then apply the trim.
Capped Arrays
ドキュメント内に固定長の配列を宣言できます。この配列には、$push、N個の終端を取り出す$slice、ソート指定、ソート後の$sliceの処理が出来ます。

capped collection のドキュメント内部版。
negative $sliceしか出来ない。capped collectionを使う時と同様の注意が必要
Text Search
Text Search has been one of the all time most requested features in MongoDB. Text indexing will offer native, real-time text search with stemming and tokenization in 15 languages. For more details on Text Search and its implementation see the docs and blog post.
Text Search
文書サーチはMongoDBに最も求められていた機能の一つです。15言語の語幹処理、トークン分割処理含むインデックスをリアルタイムに構築できます。この機能や実装のより詳細はドキュメントとブログを参照してください。

まだまだβ版もいいところ。15言語と言ってもスペース区切りの言語。
まともにトークンナイザーが組み込める様になるまでは日本語では使えない。
またワード抽出も原始的な禁止リスト(a,the,I,...)。
ここらも少なくともTF/IDFの登場までは待ちたい。
Geo Capabilities
MongoDB 2.4 introduces GeoJSON support, a more accurate spherical model and enhanced search including polygon intersection. Currently 2dsphere supports the Point, LineString and Polygon GeoJSON shapes.
Geo Capabilities
MongoDB 2.4はGeoJSONをサポートしました。より精密な球面モデルや多角形の交点を求める事ができます。現在、点、線、多角形を処理できる地理空間(球面)インデックスをサポートしています。

平面から球面に対応した。マニアック!!
Faster Counts
In many cases, counts in MongoDB 2.4 are an order of magnitude faster than previous versions. We made numerous optimizations to the query execution engine in order to improve common access patterns. One example is in a single b-tree bucket: if the first and last entry in the bucket match a count range, we know the middle keys do as well, thus we do not have to check them individually.
Faster Counts
多くの場合でMongoDB 2.4でのカウント処理は以前のバージョンより桁外れに早くなりました。我々はクエリーエンジンに一般的なアクセスパターンをターゲットにした多くの最適化をに行いました。例えばsingle b-tree bucketでは、バケットの最初と最後のエントリーが共に検索範囲内ならば、バケット内の全てのエントリーは検索範囲内であり中身を個々に評価する必要はありません。
Working Set Analyzer
Capacity planning is critical to running a MongoDB cluster. In MongoDB 2.4 we added a working set size analyzer, making it easy to measure the percentage of resources used. It will tell you how many unique pages the server has needed in the last 15 minutes, so that you can track usage over time. When the amount of data needed in 15 minutes is approaching RAM, its probably time to add more capacity to your cluster.
Working Set Analyzer
容量計画はMongoDBクラスタ運用に必須です。MongoDB2.4 ではワーキングセットサイズアナライザーが追加されました。リソース使用量(%)を簡単に得られます。またサーバが最新15分間にどの位の数の(データ)ページを必要としているか?を得ることができます。時間毎のリソース使用量情報を得られるでしょう。15分間に必要なデータ量が搭載メモリー量に近くなってきたら、そろそろ増強が必要かもしれません。

今までこの様な部分は個々のエンジニアの嗅覚に頼っていたので指標が出来たのは凄くうれしい
New V8 Engine
MongoDB 2.4 changed the JavaScript engine used for MapReduce, $where and the shell. We have switched to V8, the JavaScript engine from Google Chrome, which improves concurrency.
New V8 Engine
MongoDB 2.4 はJavaScriptエンジンをV8に変更しました。これはMapReduce、$where、シェルなどで使われます。V8エンジンはGoogle Chrome由来のもので、そちらで並行して改善されています。
Security
MongoDB 2.4 two major security enhancements: Kerberos Authentication and Role Based Access Control. Kerberos is part of MongoDB Enterprise and allows integration with enterprise level user management systems. Role Based Access Control allows more fine grained privilege management.
Security
MongoDB 2.4はケルベロス認証とロールアクセスコントロールという大きなセキュリティー向上を行いました。ケルベロスはMongoDBをエンタープライズレベルのユーザマネージメントシステムと統合する事ができます。ロールアクセスコントロールはより良い権限管理を可能にします。

レルムの切り方とかモデルケースを解説してくれると嬉しい。ゼロから運用設計はツライよー

There were hundreds (692) of improvements, so we encourage those interested to look at the changelog. A great deal of important work was done that cannot all be put into one post, so please ask questions about other tickets. Even with everything in MongoDB 2.4, there is still a lot to do, and the 10gen engineering team is already hard at work on MongoDB 2.6.

We encourage you to provide feedback and testing. Thank you for your ongoing support of MongoDB.

-Eliot and the MongoDB Engineering Team

数百(692)もの改善点があり、changelogを見る事をお勧めします。この文面に入りきらない重要な変更点もあるので、別の場で質問して貰えればと思います。MongoDB 2.4にはまだ多くのTODOがあり、10genエンジニアチームは既にMongoDB2.6に向けて活動しています。

フィードバック、テスト結果などお待ちしております。引き続きMongoDBをよろしくお願いします。

-EliotとMongoDBエンジニアチームより