I’m hungry

おもにAmazonでの衝動買いや技術的な話をぼちぼちと。

tugela cache検証(メモリ使用量制御)

2008-01-04 09:45:29 | ネットサービス/テクノロジ
まずメモリの使用量が本当に指定されたサイズまでしか使われていないかどうか
確かめてみる。

まず起動。


tugela -d -p 15000 -u nobody -c 1024 -m 100 -f /home/hoge/work/tmp/testing_tugelacache/sample.db -s 2


で、keyにインクリメントする要素(※)を付け加えてsetし続けてみる。

(※):test_key_0, test_key_1, ... , test_key_$n

起動オプションは以下のような感じ。


[hoge@fooserver ~]$ tugela -h
tugela 0.1
-p <num> port number to listen on
-l <ip_addr> interface to listen on, default is INDRR_ANY
-d run as a daemon
-r maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num> cache memory to use for items in megabytes, default is 64 MB
-c <num> max simultaneous connections, default is 1024
-f <file filename of database -E <num> expire this often seconds
-v verbose (print errors/warnings while in event loop)
-vv very verbose (also print client commands/reponses)
-h print this help and exit
-i print dbcached and libevent license
[hoge@fooserver ~]$


"-m"でメモリの使用量が制御できる。起動時、100にしているので100Mだけ
使うはず。

裏で連続setスクリプトを走らせつつ、psコマンドを実行してみる。


[hoge@fooserver ~]$ ps alx | grep tugela
1 99 27352 1 15 0 151016 138712 - Ss ? 5:04 tugela -d -p 15000 -u nobody -c 1024 -m 100 -f /home/hoge/work/tmp/testing_tugelacache/sample.db -s 10
0 524 27855 26352 18 0 64444 836 - R+ pts/2 0:00 grep tuge
[hoge@fooserver ~]$


138712KB = 135MB

...あれ?135MB使ってるような気が。

......まあいいけど。

とりあえずひたすらsetし続けてもこれ以上は増加しない模様。
tugelaを再起動してみる。


[hoge@fooserver testing_tugelacache]$ sudo /etc/init.d/tugela restart
Distributed memory/on-disk caching (tugela) を停止中: [ OK ]
Distributed memory/on-disk caching (tugela) を起動中: [ OK ]
[hoge@fooserver testing_tugelacache]$


プロセスのメモリ使用量を再度確認してみる。


[hoge@fooserver ~]$ ps alx | grep tuge
1 99 28036 1 25 0 149556 137100 - Rs ? 0:01 tugela -d -p 15000 -u nobody -c 1024 -m 100 -f /home/hoge/work/tmp/testing_tugelacache/sample.db -s 10
0 524 28039 26352 18 0 64440 832 pipe_w S+ pts/2 0:00 grep tuge
[hoge@fooserver ~]$


まああまり変わらないかな。

で、この35MB分の増分が、常に35MBなのか、それとも使用量指定に対して線形に
増加するものなのか確認してみる。

一旦tugelaを落として今度は200M使うようにして起動してみる。


tugela -d -p 15000 -u nobody -c 1024 -m 200 -f /home/hoge/work/tmp/testing_tugelacache/sample.db -s 10


先ほど同様、psコマンドで確認してみる。


[hoge@fooserver ~]$ ps alx | grep tuge
1 99 28325 1 15 0 277832 265404 - Ss ? 0:11 tugela -d -p 15000 -u nobody -c 1024 -m 200 -f /home/hoge/work/tmp/testing_tugelacache/sample.db -s 10
0 524 28365 26352 18 0 64440 832 pipe_w S+ pts/2 0:00 grep tuge
[hoge@fooserver ~]$


265404KB = 259MB

うーむ、35MBでも35MB×2でもないところがまた悩ましい...(^^;)
※このあと500MBで試してみたところ、メモリ使用量(RSS)が509MBだった。
サイズが大きくなるほど指定したメモリ使用量に近くなる様子。この増分が何かは追いかけず。(とりあえず放置静観で)

つづく。



Comment    この記事についてブログを書く
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする
« ドラゴンクエストIV 公式ガイ... | TOP | tugela cache検証(パフォー... »
最新の画像もっと見る

post a comment

ブログ作成者から承認されるまでコメントは反映されません。

Recent Entries | ネットサービス/テクノロジ