ab指令的語法是 ab -c {同時進行的request數量} -n {次數} {url}
例如:
同時連線數: 100 人
ab -n 100 -c 100 http://xx.xx.xx.xx/index.php
C:\Apache\bin>ab -n 100 -c 100 http://192.168.1.103/index.php
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 192.168.1.103 (be patient).....done
Server Software: Apache
Server Hostname: 192.168.1.103
Server Port: 80
Document Path: /index.php
Document Length: 2261 bytes
Concurrency Level: 100
Time taken for tests: 5.432 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 257300 bytes
HTML transferred: 226100 bytes
Requests per second: 18.41 [#/sec] (mean)
Time per request: 5432.000 [ms] (mean)
Time per request: 54.320 [ms] (mean, across all concurrent requests)
Transfer rate: 46.26 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 7 43.5 2 438
Processing: 292 2631 1352.8 2680 4916
Waiting: 289 2629 1352.9 2678 4915
Total: 295 2638 1348.1 2686 4918
Percentage of the requests served within a certain time (ms)
50% 2686
66% 3401
75% 3733
80% 3875
90% 4534
95% 4666
98% 4720
99% 4918
100% 4918 (longest request)
後面的幾行粗體字資料是整個回應等候時間的統計,算是 Apache Benchmark 的數據價值精華所在。這些數據表示了這 100 個人所感受到的回應速度統計。以上面這個例子來說,此次執行結果顯示這次測試結果從 2.282 秒到 4.918 秒不等。 其中50%(50)的使用者感受的反應時間是 2.686 秒以下, 90%(90)的使用者感受的反應時間是 4.534 秒中以下,所有的人均在 4.918 秒內得到回應。
2012年7月27日 星期五
2012年7月17日 星期二
[Linux] 用 ntpdate 網路對時出現錯誤 - no server suitable for synchronization found
為了校對 Linux 主機的時間,我們通常會用網路校時程式: ntpdate。
安裝方式:
# yum install ntpdate
然後執行以下命令:
# ntpdate time.stdtime.gov.tw
結果出現以下訊息:
ntpdate: no server suitable for synchronization found
透過 ntpdate 欲進行時間同步, 但是卻出現 no server suitable for synchronization found ,表示沒有適合的機器可以進行同步,但是其他台機器卻沒有這個問題?
[解決方式]:
簡查機器防火牆設定,是否有阻擋 udp 123 port 造成無法同步? 因為 NTP 是透過 port 123
如何用 php 存取 Google Apps Email
有申請 Google Apps 的人, 如果想要用php 去存取 mail server
過程如下:
...
$mbox = imap_open("{pop.gmail.com:995/imap/ssl/novalidate-cert}INBOX", $username, $password);
...
PS:
1. server 需要安裝 imap
# yum install php-imap
# /etc/rc.d/init.d/httpd restart
2. 其中 username 需要完整格式:
如; $username = "abc@xyz.com.tw";
3. 記得要在 Gmail 中 enabled pop3/imap
https://mail.google.com/support/bin/answer.py?answer=13273
[Linux] ssh 連線工具與亂碼問題
在 Windows 系統中要用 ssh 方式連線至 Linux 主機, 有時中文會出現亂碼,該如何解決呢?
- 最早的連線軟體是 PuTTY,但是此軟體不支援中文,所以有人開發了支援中文環境的 PieTTY,下載網址: http://ntu.csie.org/~piaip/pietty/
- 如下圖連線編碼需改為「Unicode UTF-8」
- 顯示正確的中文編碼了。
[Linux] Screen 指令
Linux 的系統管理員常在登錄伺服器後,然後在主機上執行一些需要很長時間的程式,這個時候如果程式沒完成就退出伺服器的話,這個執行中程式很有可能就此停止而無法完成。
此時我們就可以使用 screen 這個命令。
1. 進入 screen (新增一個 screen)
# screen
2. 執行你的命令
3. 暫時退出 screen
# [Ctrl] + a
# [Ctrl] + d
PS:所有 screen 的指令都是以 Ctrl 鍵加上 a 鍵開始的
4. 列出所有 screen
# screen -ls
There are screens on:
19761.pts-6.lms (Detached)
19372.pts-3.lms (Detached)
PS: 以上表示目前有兩個 screen
上面的 Attached 表示你現在連接的 screen ,而 Detached 則表示沒有連接的
5. 進入"特定" screen
# screen -r 19372
6. 永遠結束 screen
# exit
[Linux] ssh - 使用 scp 指令
如何使用 scp 指令來複製遠端機器的檔案
使用 scp 指令可以來透過一個安全且加密的連線在機器間傳輸檔案,就如同 rcp 指令。
傳輸一個本機檔案到遠端機器的一般語法如下:
localfile 代表來源檔案,而 username@remotehostname:/newfilename 代表目的地。
如要傳輸本機檔案 shadowman 到您在 www.abc.net 主機中的帳號,請在 shell 提示符號下輸入以下指令(使用您的使用者名稱取代 username):
這將會傳輸本機檔案 shadowman 到 www.abc.net 主機上的 /home/username/shadowman。
如果要傳輸一個遠端的檔案到本機系統,一般的語法如下:
remotefile 代表來源檔案,而 newlocalfile 代表目的地。
還可以指定多重的檔案當作來源檔案,例如要傳輸 /downloads 目錄的內容到遠端機器 www.abc.net 上一個既存的目錄稱為 uploads,請在 shell 提示符號下輸入以下指令:
使用 scp 指令可以來透過一個安全且加密的連線在機器間傳輸檔案,就如同 rcp 指令。
傳輸一個本機檔案到遠端機器的一般語法如下:
scp localfile username@remotehostname:/newfilename |
如要傳輸本機檔案 shadowman 到您在 www.abc.net 主機中的帳號,請在 shell 提示符號下輸入以下指令(使用您的使用者名稱取代 username):
scp shadowman username@www.abc.net:/home/username |
如果要傳輸一個遠端的檔案到本機系統,一般的語法如下:
scp username@remotehostname:/remotefile /newlocalfile |
還可以指定多重的檔案當作來源檔案,例如要傳輸 /downloads 目錄的內容到遠端機器 www.abc.net 上一個既存的目錄稱為 uploads,請在 shell 提示符號下輸入以下指令:
scp /downloads/* username@www.abc.net:/uploads/ |
訂閱:
文章 (Atom)


