ping -c 5 {IP地址}
“`
其中,-c參數(shù)指定測試次數(shù),默認為4次,IP地址為云服務(wù)器的公網(wǎng)IP地址。以下是測試結(jié)果:
“`
PING xxx.xxx.xxx.xxx (xxx.xxx.xxx.xxx) 56(84) bytes of data.
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=48 time=37.8 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=48 time=38.5 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=48 time=38.7 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=4 ttl=48 time=39.0 ms
64 bytes from xxx.xxx.xxx.xxx: icmp_seq=5 ttl=48 time=38.6 ms
— xxx.xxx.xxx.xxx ping statistics —
5 packets transmitted, 5 received, 0% packet loss, time 4006ms
rtt min/avg/max/mdev = 37.842/38.536/39.009/0.425 ms
“`
上述結(jié)果顯示,測試服務(wù)器的丟包率為0%,響應(yīng)時間為毫秒級別。
2. HTTP壓力測試
HTTP壓力測試是一種模擬用戶訪問并持續(xù)發(fā)送請求的測試方法,可以測試云服務(wù)器對于高并發(fā)訪問的處理能力。使用ab命令進行測試,命令為:
“`
ab -n 1000 -c 100 {URL}
“`
其中,-n參數(shù)指定發(fā)送請求的總次數(shù),-c參數(shù)指定并發(fā)連接數(shù),URL為需要測試的網(wǎng)站地址。以下是測試結(jié)果:
“`
Server Software: Apache/2.4.6
Server Hostname: xxx.xxx.xxx.xxx
Server Port: 80
Document Path: /
Document Length: 612 bytes
Concurrency Level: 100
Time taken for tests: 2.306 seconds
Complete requests: 1000
Failed requests: 0
Total transferred: 836000 bytes
HTML transferred: 612000 bytes
Requests per second: 433.30 [#/sec] (mean)
Time per request: 230.566 [ms] (mean)
Time per request: 2.306 [ms] (mean, across all concurrent requests)
Transfer rate: 353.29 [Kbytes/sec] received
Connection Times (ms)
min mean[ /-sd] median max
Connect: 39 81 22.0 75 188
Processing: 64 136 26.3 134 204
Waiting: 63 135 25.8 133 204
Total: 105 217 33.2 210 368
Percentage of the requests served within a certain time (ms)
50% 210
66% 220
75% 225
80% 228
90% 240
95% 248
98% 273
99% 287
100% 368 (longest request)
“`
上述結(jié)果顯示,在1000次請求和100個并發(fā)連接的情況下,云服務(wù)器響應(yīng)良好,請求成功率達到100%,平均響應(yīng)時間為230.566毫秒。
3. 數(shù)據(jù)庫測試
數(shù)據(jù)庫是云服務(wù)器中常用的應(yīng)用之一,測試數(shù)據(jù)庫性能是衡量云服務(wù)器應(yīng)用性能的重要指標之一。使用sysbench命令進行測試,命令為:
“`
sysbench –test=oltp –num-threads=8 –oltp-table-size=100000 –mysql-db=test –mysql-user=root –mysql-password={password} prepare
sysbench –test=oltp –num-threads=8 –oltp-table-size=100000 –mysql-db=test –mysql-user=root –mysql-password={password} run
“`
其中,–test參數(shù)指定測試方式,–num-threads參數(shù)指定測試并發(fā)線程數(shù),–oltp-table-size參數(shù)指定表格大小,–mysql-db參數(shù)指定測試數(shù)據(jù)庫名稱,–mysql-user參數(shù)指定數(shù)據(jù)庫用戶,–mysql-password參數(shù)指定數(shù)據(jù)庫密碼。以下是測試結(jié)果:
“`
sysbench 1.1.0 (using system LuaJIT 2.1.0-beta2)
Running the test with following options:
Number of threads: 8
Initializing random number generator from current time
Initializing worker threads…
Threads started!
SQL statistics:
queries performed:
read: 120000
write: 40000
other: 20000
total: 180000
transactions: 10000 (138.88 per sec.)
queries: 180000 (2506.63 per sec.)
ignored errors: 84 (1.16 per sec.)
reconnects: 0 (0.00 per sec.)
General statistics:
total time: 72.0240s
total number of events: 10000
Latency (ms):
min: 27.68
avg: 581.51
max: 4683.40
95th percentile: 837.24
sum: 5815073.71
Threads fairness:
events (avg/stddev): 1250.0000/35.81
execution time (avg/stddev): 726.8842/1.29
“`
上述測試結(jié)果顯示,在8個并發(fā)線程下,云服務(wù)器ORM模型的TPS達到138.88,平均每秒執(zhí)行2506.63次數(shù)據(jù)庫操作。
結(jié)論
綜上,以上三種測試結(jié)果表明,阿里云服務(wù)器在基本配置下表現(xiàn)良好,適用于輕度負載的應(yīng)用。在高流量壓力下,需要適當提高服務(wù)器的配置,如增大CPU、內(nèi)存、帶寬等,針對不同的應(yīng)用場景選擇不同的配置方案。同時,在使用云服務(wù)器時,要注意保護服務(wù)器安全,避免服務(wù)被惡意攻擊導(dǎo)致數(shù)據(jù)泄露,嚴重影響業(yè)務(wù)運營。
以上就是小編關(guān)于“阿里云服務(wù)器配置測試”的分享和介紹
三五互聯(lián)(35.com)是經(jīng)工信部審批,持有ISP、云牌照、IDC、CDN全業(yè)務(wù)資質(zhì)的正規(guī)老牌云服務(wù)商,自成立至今20余年專注于域名注冊、虛擬主機、云服務(wù)器、企業(yè)郵箱、企業(yè)建站等互聯(lián)網(wǎng)基礎(chǔ)服務(wù)!
公司自研的云計算平臺,以便捷高效、超高性價比、超預(yù)期售后等優(yōu)勢占領(lǐng)市場,穩(wěn)居中國接入服務(wù)商排名前三,為中國超過50萬網(wǎng)站提供了高速、穩(wěn)定的托管服務(wù)!先后獲評中國高新技術(shù)企業(yè)、中國優(yōu)秀云計算服務(wù)商、全國十佳IDC企業(yè)、中國最受歡迎的云服務(wù)商等稱號!
目前,三五互聯(lián)高性能云服務(wù)器正在進行特價促銷,最低僅需48元!
http://www.shinetop.cn/cloudhost/