ここでは、以下の環境でベンチマークを行います。
■環境

mail1.comがmail2.comに登録されている100メールアカウント宛にメールを送信します。
このベンチマークでmail1.comのSMTP性能を測ります。
(1)mail2.com側に100メールアカウントを作成する。
[root@mail2 ~]# vi user_add.sh #!/bin/sh echo -n "作成するユーザ数を入力: " read NUM for (( i = 1; i <= "$NUM"; i++ )) { useradd user"$i" echo -e "useradd user"$i" [ \e[32mOK\e[m ]" } for (( i = 1; i <= "$NUM"; i++ )) { echo "passwd" | passwd --stdin user"$i" } [root@mail2 ~]# chmod +x user_add.sh
ユーザを追加するスクリプトを作成し実行権限を与える。
ハイライトしている所(passwd)がメールアカウントのパスワードになります。
テスト用の100メールアカウントを作成する。
[root@mail2 ~]# ./user_add.sh 作成するユーザ数を入力: 100 ← # 今回作成するユーザ数 useradd user1 [ OK ] useradd user2 [ OK ] ・ ・ ・ Changing password for user user99. passwd: all authentication tokens updated successfully. Changing password for user user100. passwd: all authentication tokens updated successfully.
(2)「MStone」の設定を行う。
[root@mail1 mstone]# cd /usr/local/mstone/ [root@mail1 mstone]# vi conf/general.wld <DEFAULT> # defaults for both e-mail and revision control systems loginFormat user%ld passwdFormat passwd numLogins 100 firstLogin 1 # e-mail defaults server mail1.com # (1) smtpMailFrom user0@mail1.com # (2) addressFormat user% ld@mail2.com # (3) numAddresses 100 # (4) firstAddress 1 # (5) # revision control system defaults repoUrl http://myLocalSvn topDir repoTop/mstone </DEFAULT>
「MStone」の設定ファイルは【/usr/local/mstone/conf/general.wld】です。
(1)SMTPサーバを指定
(2)Mail Fromを指定
(3)メールのあて先を指定
(4)最大メールアカウント番号を指定
(5)最小メールアカウント番号(初番)を指定
(3)ベンチマークを実行する。
[root@mail1 mstone]# ./mstone smtp -t 60s -l 100 Mstone version 4.9.4 Copyright (c) Netscape Communications Corp. 1997-2000 Starting time: Sat May 22 23:31:46 2010 Running pretest on localhost (results/20100522.2331/localhost-log-preifconfig.txt) Running monitor on localhost (results/20100522.2331/localhost-log-vmstat.txt) Starting clients (errors logged to results/20100522.2331/stderr) Starting 1 x 100 on localhost Rampup time: 20 seconds. Test duration: 60 seconds. Clients: 100 Created results/index.html Index of runs: file:///usr/local/mstone/results/index.html Results (HTML): results/20100522.2331/results.html Updating... Sat May 22 23:32:32 2010: Reported duration 42sec (100 clients) Process 2155 exited (0). Shutting down monitors: 2154 Running posttest on localhost (results/20100522.2331/localhost-log-ifconfig.txt) Clients done: Sat May 22 23:33:03 2010 Collecting results Reported duration 60sec (100 clients) Generating results pages Processing done: Sat May 22 23:33:03 2010 Results (text): results/20100522.2331/results.txt Results (HTML): results/20100522.2331/results.html Index of runs: file:///usr/local/mstone/results/index.html Error log: results/20100522.2331/stderr (lines: 23) Mailmaster done: Sat May 22 23:33:03 2010
上記実行方法では、プロトコルにsmtpを指定している。
実行時間は60秒(1分)で対象アカウント数は100にしている。
・オプション
オプション | 説明 | |
-t | time | 実行時間を指定する。 s=秒 m=分 h=時間 |
-r | ramp_time | ランプタイムを指定する。 s=秒 m=分 h=時間 |
-l | load | メールアカウント数を指定する。 |
-b | banner | バナー名を指定する。ブラウザで結果を見る時に表示される。 |
-n | notes | ノート(メモ書き)を指定する。ブラウザで結果を見る時に表示される。 |
(4)結果(サンプル)
http://www.kurobuti.com/linux_server/result/smtp/20100522.2331/results.html
簡単に結果を説明します。
■total
「connect」から「idle」の合計です。
■connect
コネクションが張れた数です。
■banner
メールコマンドが受け付けられる状態になった数です。
■login
ログインが成功した数です。(POPやIMAPなど)
■command
メールコマンドを実行した数です。
■submit
メールの送信ができた数です。
■logout
ログアウトしてコネクションを切った数です。
(5)テスト用メールアカウント削除する。
[root@mail2 ~]# vi user_del.sh #!/bin/sh echo -n "削除するユーザ数を入力: " read NUM for (( i = 1; i <= "$NUM"; i++ )) { userdel -r user"$i" > /dev/null 2>&1 if [ $? = 6 ] ; then echo -e "userdel user"$i" [ \e[31mNG\e[m ]" else echo -e "userdel user"$i" [ \e[32mOK\e[m ]" fi } [root@mail2 ~]# chmod +x user_del.sh [root@mail2 ~]# ./user_del.sh 削除するユーザ数を入力: 100 userdel user1 [ OK ] userdel user2 [ OK ] userdel user3 [ OK ] userdel user4 [ OK ] ・ ・ ・ userdel user99 [ OK ] userdel user100 [ OK ]