rep2(現在はp2)を1.8.40から1.8.58にバージョンアップしていると、conf_admin.inc.phpに気になるコメントを見つけました。
// pecl_http が利用できる場合、HttpRequestPool による並列ダウロードを有効にする(※PHP5以上のみ可)
// この設定を有効にした場合は、$_conf['dlSubjectTotalLimitTime*'] の設定が無効となる。
// (off:0, on:1, モバイル時のみon:3) // cli:2 は未対応
$_conf['expack.use_pecl_http'] = 0; // (0)
そもそも今回玄箱からSheevaPlugに変えたのはrep2を高速化させるためでした。たしかにCPUクロックの向上とメモリの増加によりPHP自体の高速化はできたものの、[更新]ボタンを押した際のレスポンスは大して速くなりませんでした。どうやら2chのサーバからのダウンロードがボトルネックになっているようで、高速化をあきらめていましたが、並列ダウンロードとなればさらなる高速化が期待できます。早速pecl_httpを使えるようにしてみたいと思います。
とりあえずは、peclでinstallを試してみたものの
# pecl install pecl_http
pecl.php.net is using a unsupported protocal - This should never happen.
install failed
エラーが出てインストールできません。仕方がないのでソースからビルドします。
$ wget http://pecl.php.net/get/pecl_http-1.6.5.tgz
$ tar zxf pecl_http-1.6.5.tgz
$ cd pecl_http-1.6.5/
$ ./configure
…
checking for curl/curl.h... not found
configure: error: could not find curl/curl.h
curl.hが無いみたいです。
$ su -
# apt-get install libcurl3 libcurl3-gnutls
# apt-get install libcurl4-gnutls-dev
# exit
$ ./configure
…
checking for curl/curl.h... found in /usr
checking for curl-config... found: /usr/bin/curl-config
checking for curl version >= 7.12.3... 7.18.2
…
creating libtool
appending configuration tag "CXX" to libtool
updating cache ./config.cache
creating ./config.status
creating config.h
今度はうまくいきました。それでは、makeします。
$ make
…
Build complete.
Don't forget to run 'make test'.
$ su -
# make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
Installing header files: /usr/local/include/php/
# ls /usr/local/lib/php/extensions/no-debug- non-zts-20060613/
eaccelerator.so http.so
インストールされたようですので、php.iniを修正します。
# vi /usr/local/lib/php.ini
; Directory in which the loadable extensions (modules) reside.
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613/
extension=http.so
conf_admin.inc.phpを修正前後でどれぐらい応答時間が違うか「最近読んだスレ」の[更新]で測定してみます。(最近読んだスレの記録数は1000にしています。)
$_conf['expack.use_pecl_http'] = 0の場合
192.168.1.xxx - - [10/Sep/2009:21:36:51 +0900] "GET ..... HTTP/1.1" 200 214782 20
$_conf['expack.use_pecl_http'] = 1の場合
192.168.1.xxx - - [10/Sep/2009:21:40:11 +0900] "GET ..... HTTP/1.1" 200 214782 14
20秒→14秒...1.43倍,うーん微妙。
最近のコメント