11gで追加されたConnectionPoolを試してみた
DRCPというらしいです
http://www.ujp.jp/modules/d3blog/details.php?bid=476&cid=47
http://www.oracle.com/technology/global/jp/tech/oci/pdf/oracledrcp11g.pdf
設定は簡単です
DBにsysで入って
dbms_connection_pool.start_pool();
って打つと起動します。
あとはクライアント側のtnsnames.oraの
SERVER = DEDICATEとかなってるとこを SERVER = POOLED に変更すればok
PHPとApacheのabコマンド使って計測してみた
PHPのソース(ただつないで切ってるだけ)
<?php $res = oci_connect("ユーザ","パスワード","接続識別子"); oci_close($res); ?>
これを ab コマンドで叩きまくる。
ab -n 1000 -c 10 http://localhost/connect_test.php
そして結果
まずは通常の専用サーバのみ
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Server Software: Apache/2.2.14 Server Hostname: localhost Server Port: 80 Document Path: /connect_test.php Document Length: 0 bytes Concurrency Level: 10 Time taken for tests: 58.575 seconds Complete requests: 1000 Failed requests: 0 Write errors: 0 Total transferred: 241000 bytes HTML transferred: 0 bytes Requests per second: 17.07 [#/sec] (mean) Time per request: 585.751 [ms] (mean) Time per request: 58.575 [ms] (mean, across all concurrent requests) Transfer rate: 4.02 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 2.1 0 16 Processing: 109 583 103.8 578 1312 Waiting: 94 583 103.9 578 1312 Total: 109 583 103.8 578 1312 Percentage of the requests served within a certain time (ms) 50% 578 66% 594 75% 594 80% 609 90% 641 95% 750 98% 906 99% 1125 100% 1312 (longest request)
次にプーリングした専用サーバ
This is ApacheBench, Version 2.3 <$Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking localhost (be patient) Server Software: Apache/2.2.14 Server Hostname: localhost Server Port: 80 Document Path: /connect_test.php Document Length: 0 bytes Concurrency Level: 10 Time taken for tests: 36.467 seconds Complete requests: 1000 Failed requests: 49 (Connect: 0, Receive: 0, Length: 49, Exceptions: 0) Write errors: 0 Total transferred: 259130 bytes HTML transferred: 18032 bytes Requests per second: 27.42 [#/sec] (mean) Time per request: 364.669 [ms] (mean) Time per request: 36.467 [ms] (mean, across all concurrent requests) Transfer rate: 6.94 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 1.4 0 16 Processing: 16 362 238.9 297 1797 Waiting: 16 362 238.8 297 1797 Total: 16 363 239.2 297 1797 Percentage of the requests served within a certain time (ms) 50% 297 66% 344 75% 359 80% 375 90% 453 95% 1141 98% 1203 99% 1656 100% 1797 (longest request)
おぉ、まぁまぁ早くなりましたね。
今回の環境はwindowsでおこないました。
次は、コネクションプールにたまってるセッションがどういう状態なのか調査します。