ラベル Apache の投稿を表示しています。 すべての投稿を表示
ラベル Apache の投稿を表示しています。 すべての投稿を表示

2010年7月5日月曜日

TeamViewer5でPort80を閉じる

PCのリモートソフトとして、TeamViewer5 をつかい、2ヵ所のPCを管理している。
このソフトは、Web Serverでよく使われる Port80 をサービスとして起動しているため、ローカルでApache、AN_HTTPD 等起動できない。

早速、Googleで調べてみると・・・ありました。

TeamViewer5 で Port 80 を起動しない方法

レジストリエディタ regedit で

HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer\Version5
GatewayAllowed
 と ListenHttp
DWORD値 1 → 0
2つの項目のDWORD値を 1 から 0 に変更すればよい。

TeamViewer5の起動後、AN_HTTPDを起動してみるとOK、勿論WAMP環境でもOKでした。

2010年1月26日火曜日

キャッシュ及びアクセラレーターの比較

ベンチマークの比較です。
1.Apacheのキャッシュ機能を有効にした場合
2.PHPアクセラレーター(Xcache)を使った場合
3.XOOPSのキャッシュ機能を有効にした場合

サーバーを設置した場所とは全く別のサイトにCentOS環境を作成し、下記コマンドで比較した

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
比較表
               Normal    Apache Cache On   PHP Xcache On
Time taken for tests:
1回目           28.921658     21.236325       12.785964
2回目           22.197865     24.28028       10.592108
3回目           29.399440     21.620780
Requests per second:
1回目           3.46         4.71           7.82
2回目           4.50         4.16           9.44
3回目           3.44         4.63

確かに速くなってます。
Xcacheでは体感上も確実に速度アップしました。
XOOPSのキャッシュ機能での比較はでは殆んど変化しなかったためここには載せていません。
設定が悪いのだろうか?

2010年1月25日月曜日

Xcacheを設定した場合のベンチマーク

1回目

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

benchmarking xxxx-net.jp (be patient).....done

Server Software: Apache
Server Hostname: xxxx-net.jp
Server Port: 80
Document Path: /
Document Length: 0 bytes
Concurrency Level: 10
Time taken for tests: 12.785964 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 36400 bytes
HTML transferred: 0 bytes
Requests per second: 7.82 [#/sec] (mean)
Time per request: 1278.596 [ms] (mean)
Time per request: 127.860 [ms] (mean, across all concurrent requests)
Transfer rate: 2.74 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 51 360 899.9 64 3050
Processing: 403 817 411.1 757 4253
Waiting: 402 807 404.0 753 4252
Total: 467 1177 1042.7 812 4318
Percentage of the requests served within a certain time (ms)
50% 812
66% 857
75% 878
80% 915
90% 4029
95% 4050
98% 4068
99% 4318
100% 4318 (longest request)
2回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software: Apache
Server Hostname: xxxx-net.jp
Server Port: 80

Document Path: /
Document Length: 0 bytes

Concurrency Level: 10
Time taken for tests: 10.592108 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 36400 bytes
HTML transferred: 0 bytes
Requests per second: 9.44 [#/sec] (mean)
Time per request: 1059.211 [ms] (mean)
Time per request: 105.921 [ms] (mean, across all concurrent requests)
Transfer rate: 3.30 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 53 92 283.0 63 2893
Processing: 439 843 1152.4 626 8477
Waiting: 438 835 1151.4 626 8477
Total: 505 936 1177.1 691 8542

Percentage of the requests served within a certain time (ms)
50% 691
66% 723
75% 757
80% 805
90% 1043
95% 1437
98% 8442
99% 8542
100% 8542 (longest request)
約二倍ほど速くなったかな??

PHP アクセラレーターXcacheのインストール

早速インストール

[root@centos ~]# cd /usr/local/src
[root@centos src]# wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
[root@centos src]# tar xzvf xcache-1.3.0.tar.gz
[root@centos src]# cd xcache-1.3.0
[root@centos xcache-1.3.0]# phpize
[root@centos xcache-1.3.0]# ./configure --enable-xcache
[root@centos xcache-1.3.0]# make/usr/include/php/ext/date/lib/timelib_structs.h:24:28: error: timelib_config.h: No such file or directory/usr/local/src/xcache-1.3.0/xcache.c:2959: warning: initialization discards qualifiers from pointer target type
make: *** [xcache.lo] エラー 1

失敗!
googleで検索
Posted by moo XCache
on 15.08.2009 02:52
not a XCache problem. looks like it have problem searching .h file witin the same directory which compiler are u using? i assume it's gcc... hrm... open /usr/include/php/ext/date/lib/timelib_structs.h change #include timelib_config.hto #include "timelib_config.h" (or vice versa) or #include "/usr/include/php/ext/date/lib/timelib_config.h"
とあるので、timelib_structs.h を編集、保存
再度
[root@centos xcache-1.3.0]# make
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
[root@centos xcache-1.3.0]# make install
Installing shared extensions:     /usr/lib/php/modules/
成功!
次に設定ファイルの配置xcache.iniの内容を上記インストールディレクトリーに書き換え、パスワードを設定し保存、コピー
まず最初にコマンドラインからxcache.admin.passの値を求めてメモしておく。(******は各自適当に)
[root@centos xcache-1.3.0]# echo -n '******' | md5sum ←これをUser欄に挿入
XXXXXXXXXX ←これをパスワード欄に挿入
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
zend_extension = /usr/lib/php/modules/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so
;; or win32:
; extension = php_xcache.dll

[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "*******"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = "XXXXXXXXXXX"
[root@centos xcache-1.3.0]# cp xcache.ini /etc/php.d/
Webサーバーの再起動とXcacheの起動確認
[root@centos xcache-1.3.0]# /etc/rc.d/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]
[root@centos xcache-1.3.0]# php -v
PHP 5.1.6 (cli) (built: Jan 13 2010 17:13:05)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
はいOK!
続いて、ブラウザ管理の設定
adminディレクトリー内のファイルを/var/www/xcacheへコピー
[root@centos xcache-1.3.0]# mkdir /var/www/xcache
[root@centos xcache-1.3.0]# cd admin
[root@centos xcache-1.3.0]# cp * /var/www/xcache/
/var/www/xcache/をブラウザから見れるように設定する。適当にxcache.confファイルを作成し放り込む
で!設定ファイルが見れるようになりましたとさ・・・
後は後日!

2010年1月20日水曜日

1.Apacheのキャッシュ機能を有効にした場合

設定は、ここを参照

1回目

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   21.236325 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.71 [#/sec] (mean)
Time per request:       2123.632 [ms] (mean)
Time per request:       212.363 [ms] (mean, across all concurrent requests)
Transfer rate:          1.65 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       53  502 1466.4     66    8965
Processing:   294 1590 1904.3   1167   11519
Waiting:      290 1589 1903.3   1167   11518
Total:        398 2093 2385.1   1302   11602

Percentage of the requests served within a certain time (ms)
  50%   1302
  66%   1399
  75%   1762
  80%   2037
  90%   4711
  95%   9868
  98%  10700
  99%  11602
 100%  11602 (longest request)
2回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   24.28028 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.16 [#/sec] (mean)
Time per request:       2402.803 [ms] (mean)
Time per request:       240.280 [ms] (mean, across all concurrent requests)
Transfer rate:          1.46 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       52  539 1089.9     68    3076
Processing:   285 1720 3026.7    919   15435
Waiting:      285 1718 3026.6    919   15434
Total:        342 2259 3539.5   1159   18424

Percentage of the requests served within a certain time (ms)
  50%   1159
  66%   1520
  75%   1882
  80%   3379
  90%   4179
  95%  14152
  98%  18274
  99%  18424
 100%  18424 (longest request)
3回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   21.620780 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.63 [#/sec] (mean)
Time per request:       2162.078 [ms] (mean)
Time per request:       216.208 [ms] (mean, across all concurrent requests)
Transfer rate:          1.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       51  776 1939.9     64    9003
Processing:   287 1269 1013.0   1029    5055
Waiting:      284 1268 1013.1   1029    5055
Total:        341 2046 2229.2   1241   10864

Percentage of the requests served within a certain time (ms)
  50%   1241
  66%   1650
  75%   3247
  80%   3409
  90%   4477
  95%   5722
  98%  10700
  99%  10864
 100%  10864 (longest request)

若干速くなったかな?のレベル!

2010年1月18日月曜日

Apache Server カスタマイズ??

Apacheのカスタマイズについて記事を拾ってみた。
そのうち時間ができたら検証してみることに・・・

まずは参照サイトを記述

GIGAZINE

ここを参照に随時トライしてみようと思う・・・

1.BufferedLogs ディレクティブの変更
参考
apacheのコンフィグファイルにBufferedLogsディレクティブをonにする

BufferedLogs on
後は、ab(apache bench)で検証しよう。

2.mod_mem_cacheの有効化
参考1  参考2
テストした環境はDSO環境なのでApacheへのモジュール有効化はLoadModuleで行うこと。
気をつける点はmod_mem_cacheは mod_cacheのサポートモジュールとして動作するので、
モジュールを有効にする場合はmod_cacheとセットで扱うこと。
<ifmodule mod_mem_cache.c="">
CacheEnable mem /
MCacheSize 262144
MCacheMaxObjectCount 100000
MCacheMinObjectSize 1
MCacheMaxObjectSize 131072
</IfModule>