[Groonga-commit] droonga/presentation-droonga-meetup-1-introduction at e8376a1 [master] Add how to determine database size for benchmarking

Back to archive index

Piro / YUKI Hiroshi null+****@clear*****
Wed Jul 30 01:28:42 JST 2014


Piro / YUKI Hiroshi	2014-07-30 01:28:42 +0900 (Wed, 30 Jul 2014)

  New Revision: e8376a1680b33ca7cc3e2c48698aad5e5b0d039d
  https://github.com/droonga/presentation-droonga-meetup-1-introduction/commit/e8376a1680b33ca7cc3e2c48698aad5e5b0d039d

  Message:
    Add how to determine database size for benchmarking

  Modified files:
    benchmark/README.md
    introduction.md

  Modified: benchmark/README.md (+30 -11)
===================================================================
--- benchmark/README.md    2014-07-29 10:56:36 +0900 (6ab58a5)
+++ benchmark/README.md    2014-07-30 01:28:42 +0900 (4168eae)
@@ -35,20 +35,43 @@
 
 ## 準備
 
-あらかじめ、Wikipediaのデータを取得しておく。
+### worker数とデータベースサイズの決定
+
+worker数は、CPUの個数に合わせる。これは以下の方法で調べられる。
+
+    % cat /proc/cpuinfo | grep processor | wc -l
+
+Droongaのworkerは、1プロセスあたり最大でデータベースの大きさと同じだけのメモリを消費する。
+例えばworker数4でデータベースサイズが2GiBなら、消費するメモリの量は最大で2×4=8GiBとなる。
+
+データベースサイズが実メモリの量より大きいと、スワップが発生して性能が低下する。
+しかしデータベースサイズが小さすぎると、検索の処理が軽すぎてベンチマークを取りにくくなる。
+よって、データベースサイズが実メモリをギリギリ使い切らない程度のサイズになるようにする必要がある。
+
+上記の検証環境では、ノードのうち2台が8GB、1台が6GBのメモリを積んでいる。
+なので、6÷4=1.5GB程度のデータベースサイズが適切と考えられる。
+
+### データの準備
+
+Wikipediaのデータを取得し、Groongaのダンプファイルに変換する。
 
     % cd ~/
     % git clone https://github.com/droonga/wikipedia-search.git
     % cd wikipedia-search
     % bundle install
-    % rake data:convert:groonga:ja
+    % time rake data:convert:groonga:ja
 
 既定の状態では、Wikipedia日本語版の全ページのうち先頭5000件、各ページは先頭から1000文字までのみ変換される。
-Wikipeida日本語版の全ページ・全内容を変換するには、以下の箇所で「--max-n-*」を指定しているコマンドラインオプションをコメントアウトする。
+それ以上の件数を変換するには、以下の箇所で「--max-n-*」を指定しているコマンドラインオプションを変更する。
 (正しいやり方が分かり次第、この説明を更新する。)
 
 https://github.com/droonga/wikipedia-search/blob/master/lib/wikipedia-search/task.rb#L79
 
+検証時には、184万件のページ全件をロードするとデータベースは17GiB程度になった。
+大雑把に考えて、10万件で1GiBになる。
+前述の計算から、データベースサイズは1.5GiB程度までに収める必要があるので、ロードするべきページの件数は15万件程度が妥当と言える。
+
+
 ## Groongaのセットアップ
 
 192.168.200.254でのみ行う。
@@ -63,19 +86,14 @@ https://github.com/droonga/wikipedia-search/blob/master/lib/wikipedia-search/tas
 
 ### データベースの用意
 
+    % rm -rf $HOME/groonga/db/
     % mkdir -p $HOME/groonga/db/
     % groonga -n $HOME/groonga/db/db quit
     % time (cat ~/wikipedia-search/config/groonga/schema.grn | groonga $HOME/groonga/db/db)
     % time (cat ~/wikipedia-search/config/groonga/indexes.grn | groonga $HOME/groonga/db/db)
     % time (cat ~/wikipedia-search/data/groonga/ja-pages.grn | groonga $HOME/groonga/db/db)
 
-検証環境ではこのくらいの時間がかかった。
-
-    [[0,1406253871.65481,38379.038287878],1840587]
-    
-    real    640m9.076s
-    user    149m33.176s
-    sys     4m38.246s
+検証環境では、184万件全件のロードだと10時間程度かかった。
 
 
 ### HTTPサーバの起動
@@ -95,6 +113,7 @@ https://github.com/droonga/wikipedia-search/blob/master/lib/wikipedia-search/tas
     % sudo apt-get install -y ruby ruby-dev build-essential nodejs nodejs-legacy npm
     % sudo gem install droonga-engine grn2drn drnbench
     % sudo npm install -g droonga-http-server
+    % rm -rf ~/droonga/000 ~/droonga/state
     % mkdir ~/droonga
     % droonga-engine-catalog-generate \
         --hosts=192.168.200.254,192.168.200.3,192.168.200.4 \
@@ -165,7 +184,7 @@ droonga-sendを使うが、スキーマ定義の時は宛先は1ノードだけ
     % sudo apt-get install -y ruby
     % sudo gem install drnbench
 
-[よく検索されるページの一覧](http://stats.grok.se/ja/top)から、検索リクエストのパターンファイルを作成する。
+ページのタイトルから、検索リクエストのパターンファイルを作成する。
 
     % echo '{"wikiledia-ja-search-with-query":{"frequency":0.5,"method":"get","patterns":[' \
         > patterns.json

  Modified: introduction.md (+4 -2)
===================================================================
--- introduction.md    2014-07-29 10:56:36 +0900 (deb1866)
+++ introduction.md    2014-07-30 01:28:42 +0900 (61ab0e9)
@@ -190,9 +190,11 @@ GroongaからDroongaへ
 # Groongaとの性能比較
 
  * 検索対象:
-   Wikipedia日本語版の全ページ
+   Wikipedia日本語版の全ページのうち
+   先頭から15万件を使用
  * 検索クエリ:
-   よく見られているページのタイトル上位1000件
+   ロードしたページのうち
+   1000件のタイトルを使用
  * キャッシュヒット率:
    50%
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index