Posts tagged Apache
YMC vs CPI
1月 7th
VPSのbenchmark。 目的:ネットワーク帯域など、クライアントから見たHTTPのレスポンス性をチェックする。
測定環境 apache上げて単純なHTMLファイルの転送。
ファイルの内容:
<html><body><h1>It works!</h1></body></html>
apache benchのオプション:
% /usr/local/apache2/bin/ab -n 1000 -c 2
Requests per second: 34.84 [#/sec] (mean)
Requests per second: 163.67 [#/sec] (mean)
結果 4.7倍 CPIが高速!
マルチバイトサブドメインを使うときの設定
11月 26th
マルチバイトサブドメインとは、http://テスト.example.com/のように、マルチバイトを含んだサブドメインのホストへアクセスすることを言う。
普通は、Punycode (RFC 3492)を利用して、エンコードする。テスト.example.comの場合はxn--zckzah.example.comとなる。
しかし、ブラウザ(携帯端末)がRFC 3492対応していなかったり、マルチバイトサブドメインを含んだURLを貼り付けた掲示板がPunycodeを想定していない場合(Youtube)があるため、サービス提供者側でいくつかのエンコード形式でアクセスされたときのことを想定しておかなければならない。具体的には以下の3つ。
- Punycode
- UTF-8のurlencode
- UTF-8
Apacheの設定は以下のようになる。 ” http://テスト.example.com” の場合
<virtualhost *:80> ServerName xn--zckzah.example.com DocumentRoot /var/www/path/to/htdocs </virtualhost> <virtualhost *:80> ServerName %83e%83X%83g.example.com Redirect permanent / http://xn--zckzah.example.com/ </virtualhost> <virtualhost *:80> ServerName テスト.example.com Redirect permanent / http://xn--zckzah.example.com/ </virtualhost>
VPSのHTTP速度
10月 19th
jpgファイル: 145.19 KB % /usr/local/apache2/bin/ab -n 100 接続元:Fiberbit
測定結果平均リクエスト完了時間 @YMC: 259ms CloudFront: 48ms CPI: 141ms
YMC VPSベンチマーク
9月 8th
YMCのVPSを使っています。 しかしながら、ページ表示速度が遅いのでまず静的HTMLでベンチマーク取ってみました。 利用しているサービスはカスタム10。
測定環境- 回線:100Mbps 光ファイバ(goo スピードテストで66.37Mbps)
- ルータ経由数:21
以下、測定結果。 重要なポイントだけ引用。
% date
Tue Sep 8 01:54:15 JST 2009
% /usr/local/apache2/bin/ab -n 100
Server 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 More > PHP 5.2.10 configure error
6月 20th
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
6月 13th
mixiでは以下の値らしい。
KeepAlive On KeepAliveTimeout 1 MaxKeepAliveRequest 20
思ったこと: KeepAliveTimeoutは1でいいんだ。
PHPでQRCode
3月 7th
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のリダイレクト
12月 1st
携帯では、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]
最近のコメント