apacheタグのついている投稿
CGI benchmarking
2009年11月13日
YMC VPSベンチマーク
2009年9月8日
YMCのVPSを使っています。
しかしながら、ページ表示速度が遅いのでまず静的HTMLでベンチマーク取ってみました。
利用しているサービスはカスタム10。
測定環境
- 回線:100Mbps 光ファイバ(goo スピードテストで66.37Mbps)
ベンチマーク1
- ルータ経由数:21
以下、測定結果。
重要なポイントだけ引用。
% date Tue Sep 8 01:54:15 JST 2009 % /usr/local/apache2/bin/ab -n 100Server Software: Apache/2.2.11 Document Length: 18661 bytes Concurrency Level: 1 Time taken for tests: 11.174 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 1896400 bytes HTML transferred: 1866100 bytes Requests per second: 8.95 [#/sec] (mean) Time per request: 111.743 [ms] (mean) Time per request: 111.743 [ms] (mean, across all concurrent requests) Transfer rate: 165.73 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 23 24 0.5 24 26 Processing: 73 87 51.1 76 350 Waiting: 23 25 1.2 25 32 Total: 98 112 51.1 100 374
まとめると以下。
- 回線が遅い
- レスポンスが来るまでが遅い(Processingの時間が長い)
ベンチマーク2
YMCのトップページの表示速度はすごく速いのでベンチマーク取ってみた。
- ルータ経由数:16
% date
Tue Sep 8 01:54:15 JST 2009
% /usr/local/apache2/bin/ab -n 100 http://www.ymc.ne.jp/
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 www.ymc.ne.jp (be patient).....done
Server Software: Apache/2.0.52
Server Hostname: www.ymc.ne.jp
Server Port: 80
Document Path: /
Document Length: 27895 bytes
Concurrency Level: 1
Time taken for tests: 4.105 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 2804900 bytes
HTML transferred: 2789500 bytes
Requests per second: 24.36 [#/sec] (mean)
Time per request: 41.049 [ms] (mean)
Time per request: 41.049 [ms] (mean, across all concurrent requests)
Transfer rate: 667.29 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 4 6 0.5 6 8
Processing: 34 35 0.6 35 38
Waiting: 7 8 0.3 8 9
Total: 39 41 0.8 41 45
比較
VPSが19KB、YMCのHTMLが28KBなのに、この差。
PHP 5.2.10 configure error
2009年6月20日
PHP5.2.10が出たので開発環境へインストール。
5.2.8と同じオプションでconfigureしたのにこんなエラーが出た。
% ./configure --enable-mbstring --enable-soap --enable-zend-multibyte --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-curl --with-curlwrappers --with-gd --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir=/usr/lib --with-mcrypt
.....
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl -dir>/include/curl/
環境は、
# cat /etc/issue Debian GNU/Linux 5.0 \n \l
headerファイルインストールして解決
# aptitude install libcurl4-gnutls-dev
apacheのKeepAliveTimeout
2009年6月13日
mixiでは以下の値らしい。
KeepAlive On KeepAliveTimeout 1 MaxKeepAliveRequest 20
思ったこと:
KeepAliveTimeoutは1でいいんだ。
PHPでQRCode
2009年3月7日
PHPでQRコードを作る方法。
Extensionを使う。
インストール
wget http://www.opendogs.org/pub/php_qr-0.3.1.tgz tar zxvf php_qr-0.3.1.tgz cd php_qr-0.3.1 phpize ./configure --enable-qr make install /usr/local/apache2/bin/apachectl graceful
PHPコード
< ?php
$qr = new QRCode();
$qr->setMagnify(3);
$qr->setFormat(QRCode::FMT_GIF);
$qr-addData($data);
$qr->finalize();
header('Content-type: image/gif');
print $qr->getSymbol();
上記以外にもオプションがいっぱい用意されている。
APIリファレンスが見づらいなぁ。
携帯ページで使うapacheのリダイレクト
2007年12月1日
携帯では、temporary moved(302)を返すべき!
moved permanent (301)を返すと、DoCoMoで警告がでちゃいます。auでは出ないことを確認しました。
警告を出さないようにするためには、Found(302)を返します。RedirectディレクティブのデフォルトがFoundなので、以下のように書けば問題ないです。
Redirect /service http://foo2.bar.com/service
以下でも同義
Redirect temp /service http://foo2.bar.com/service
mod_rewriteだと以下のように
RewriteRule ^/service/(.*) http://foo2.bar.com/service/$1 [R=302,L]
複数台で運用しているサーバのアクセスログを1つに統合する
2007年11月30日
複数台のフロントエンドサーバでapacheが動いている場合を想定します。
その場合、アクセスログが複数のサーバにまたがってしまいます。
こんなかんじ。
- web-01.access-log.20071130
- web-02.access-log.20071130
- web-03.access-log.20071130
webalizerやawstatsといったアクセスログ解析ソフトではこのファイルの状態では解析できない。
なぜなら、webalizerやawstatsのデフォルトでは1つのファイルのみを入力として受け付け、時系列順に記録されていなければならない。
この問題を解決するスクリプトを発見しました。awstatsの中に入っているlogresolvemerge.plというperlスクリプトです。
使い方は超簡単。引数に統合したいファイルを指定して実行すると、標準出力に時系列順にそろったレコードが出力される。
例:
% perl logresolvemerge.pl /path/to/log/*access.log.20071130|more
引数にgz圧縮されたファイルを指定してもちゃんと動きます。至れり尽くせりなスクリプト。
★おまけ情報★
ある日まで、commonフォーマットでアクセスログを取っていて、ある時点からcombinedフォーマットでログを取りだした場合、1つのアクセスログの中に2種類のフォーマットのログが混入してしまう。
そこで見つけたのがこの方法。commonフォーマットをcombinedフォーマットにする方法。
http://www.trisweb.com/archives/2007/02/15/convert-apache-common-logs-to-combined-logs/
3回シェルのコマンドを実行すればできちゃう!CUIはすばらしい。
参照:
Compiling subversion from source distribution.
2007年10月1日
% ./configure --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2 --with-ssl % make # make install
subversion-1.4.5 on linux CentOS 4.4.
クライアントしか使わなければ、このオプションもつけた方がいい。–disable-mod-activation
WebからPHPのPEARをインストール
2007年8月30日
新規案件のサーバをセットアップしているときに、pearでライブラリを入れていたら、
「Webのインストーラあるよ」と表示されたからちょっと試しに使ってみた。
PEAR: Optional feature webinstaller available (PEAR’s web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR’s PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR’s PHP-GTK2-based installer)
To install use “pear install pear/PEAR#featurename”
初期設定はこんな感じ。ホームディレクトリは /home/matsu/ ね。
cd public_html
mkdir go-pear
cd go-pear
wget http://pear.php.net/go-pear
mv go-pear go-pear.php
chmod 777 /home/matsu/public_html/go-pear
go-pear.phpにアクセスしたところ。

1 start up, originally uploaded by supermatsubokkuri.



最近のコメント