MYSQLで ReadOnly なユーザの作りかた
GRANT SELECT ON *.* TO readonly@"%" IDENTIFIED BY ""; GRANT SELECT ON *.* TO readonly@"localhost" IDENTIFIED BY ""; GRANT SELECT ON *.* TO readonly@"10.0.%.%" IDENTIFIED BY ""; GRANT SELECT ON *.* TO readonly@"192.168.%.%" IDENTIFIED BY ""; FLUSH PRIVILEGES;
低コストなwebサーバ (HP ProLiant ML115 G1) パフォーマンス検証
ネットワークは、光AUギガ特
ルータ (Aterm BL190HW) http://www.aterm.jp/kddi/190hw/index.html
ルータと、光のモデム間を、カテゴリ7ケーブルにて結線
ルータと、サーバ機とも、カテゴリ7ケーブルにて結線
ハードはHP ProLiant ML115 G1 (後継は、ML115 G5)
OS:8.1-RELEASE FreeBSD
WebServer:apache2.2.16(HTTP Accept Filter 適応済み)
abにて測定
ab -n 1000 -c 100
Server Software: Apache/2.2.16
Server Port: 80
Document Path: /
Document Length: 4243 bytes
Concurrency Level: 100
Time taken for tests: 11.958 seconds
Complete requests: 1000
Failed requests: 0
Write errors: 0
Total transferred: 4557720 bytes
HTML transferred: 4263255 bytes
Requests per second: 83.63 [#/sec] (mean)
Time per request: 1195.769 [ms] (mean)
Time per request: 11.958 [ms] (mean, across all concurrent requests)
Transfer rate: 372.22 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 19 246 636.4 124 6323
Processing: 191 712 223.4 675 1818
Waiting: 27 336 233.3 245 1185
Total: 215 958 698.6 812 7031
Percentage of the requests served within a certain time (ms)
50% 812
66% 858
75% 915
80% 963
90% 1150
95% 1731
98% 4009
99% 4221
100% 7031 (longest request)
おもったよりも、apacheと自宅の回線でも
パフォーマンスは出た。
LANがジャンボフレームに対応していないから
取り替えると早くなるかも。
python de UnicodeDecodeError
cat <<EOT | sudo tee /usr/local/lib/python2.6/site-packages/sitecustomize.py import sys sys.setdefaultencoding("utf-8") EOT
webアプリケーション開発時にクライアント認証部分とか意識するのは、いやだ
クライアントの認証部分を開発するのが嫌だから、前段のwebサーバで行いたい。
クライアント -> フロントwebサーバ -> アプリケーションサーバ
の流れでリクエストが伝搬されていく際に
フロントのwebサーバで認証処理を行って、アプリケーションサーバに
httpリクエストが伝搬される際に、httpのヘッダ情報を拡張して
クライアントのIDを付与する
アプリケーションサーバでは、クライアントのIDを取得するだけになるので
追加でアプリケーションを開発する際の認証処理をあまり考慮しなくて済む。
catalyst で 強引にフォワードさせてみたかった。
package specification::View::Forward; use strict; use HTTP::Request; use HTTP::Response; use LWP::UserAgent; use base qw( Catalyst::View ); __PACKAGE__->mk_accessors('forwardurl'); =head1 NAME specification::View::Forward =head1 DESCRIPTION =head1 AUTHOR =head1 SEE ALSO L<specification> =head1 LICENSE This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut sub new { my($class, $c, $arguments) = @_; my $self = $class->next::method($c); return $self; } sub process { my ( $self, $c ) = @_; my $url = $c->stash->{forwardurl}; my $ua = new LWP::UserAgent; my $req = HTTP::Request->new('GET' => $url); my $res = $ua->request($req); $c->response->body($res->content); } 1;