Technology

簡單測試 bandwidth 方法

公司需要在北京找一個 data center 放 server,最後通過 agent 決定在位於中關村科技發展大廈的電信通數據中心(前身中關村數據)租了一個 2U 100M shared 的地方。Agent 說能保證 bandwidth 最少 1Mbps,最多也不會超過 1.2Mbps。但基於 sales 的不可信性 (the unbelievability of salesperson),還是有自己去測試一下 bandwidth 的必要的。這裡給大家一個簡單的 poor man’s way 來測試 bandwidth,一般人會用 HTTP/FTP 傳送 file 的方法來看一下速度有多快,但是需要先裝好 HTTP 或 FTP daemon。我喜歡用 netcat,因為使用非常簡單。除了 netcat,你亦需要一個用來 monitor network bandwidth usage 的軟件,用來查看實際的網絡流量,推薦使用 muninntop

netcat 的使用方法非常簡單,步驟如下:

  1. 假設我的 server 叫電腦 A,你需要再多找一台電腦,叫電腦 B(我就找了一台在香港 data center 的 server)
  2. 在電腦 B 執行命令:netcat -l -p 10000 > /dev/null。意思就是用 netcat 監聽 port 10000,而且接收到的所有 data 都當成是垃圾扔到 /dev/null 這個黑洞裡。
  3. 在電腦 A 執行命令:netcat [電腦 B 的 IP] 10000 < /dev/urandom。意思就是連接到電腦 B 的 port 10000, 並且不斷 send data。 Linux 會為 /dev/urandom 不斷的供應一些隨機的 data。

就這樣,便可以測試電腦 A 的 outbound bandwidth 了。再多找兩三台電腦(當然是在不同的 network 的)同時 send 和 receive,差不多就能把可用的 bandwidth 用盡了。如果要測試 inbound bandwidth,把 A 和 B 的身份對換就可以了。

P.S. 測試後發現,bandwidth 比想像中的要好,深夜的時候可以達到 3Mbps,連到國內的 server 更可以達到 10Mbps!到白天基本上 bandwidth 就回落了。

Network bandwidth testing for Beijing server using munin

Popularity: 9% [?]

Asus notebook explosion

Asus notebook is cheap, but you definitely don’t want it to explode under your palms when you have been using it for a few hours. Stay away from Asus!

Chinese news report:
http://www.315union.com/asus/2006/02/6683.html

exploded Asus notebook

Popularity: 5% [?]

IBM, you have betrayed me three times

My IBM X40 notebook is having problems again, this time is the USB subsystem. No matter what USB devices I plug into the computer, they are not detected.

First was the harddisk, and then it was the battery, now it is USB. I’m fed up with all the problems I met with this notebook computer. If the quality of IBM notebooks has become so low, I wonder Lenovo won’t be any better.

Popularity: 7% [?]

Ripping FLAC on Mac OS X

I always want to listen to my music on my iAudio M3 portable player at the highest fidelity, so OGG Vorbis (.ogg) is already not enough to me. I’m slowing migrating my collection of music to FLAC. On Linux this task is trivial, because I just have to change the encoder setting in jack (the name of the text-based frontend that I use) from oggenc to flac. But ripping CDs on Mac OS X is new to me. After some searching and testing, I stick with MARS.

There are other encoders like xACT and jRpper, but they all require some setup like installing the backend encoders separately. MARS is straightforward and easy to use, and can encode to OGG or FLAC files. Most importantly, MARS can query FreeDB and tags your songs automatically. The drawback is MARS inherits the same encoding problem like any other ripping softwares that make use of FreeDB. If the names of your songs are all in English, you’ll be fine, but if you have to rip Chinese and Japanese CDs like me, then all you get is some strange characters, because there is no encoding information in FreeDB records, they can be in Big5, GB2312 or whatever encoding. Moreover, until CDDB protocol level 6, only ASCII and ISO-8859-1 are supported. So unless your client is compliant with level 6, you will always get rubbish. At the end, I have to copy the song names manually from iTunes to MARS. Yes, iTunes get it right.

Popularity: 10% [?]

“The most difficult blog to read in the world”

All articles in this blog are encoded in QR codes!
http://www.qrcodeblog.com/

Popularity: 5% [?]