Như các bạn đã biết ở các thiết bị máy tính, khi bạn muốn kiểm tra tốc độ network, đường truyền bạn chỉ cần truy cập vào speedtest.net là có thể kiểm tra. Tuy nhiên ở VPS Linux bạn không thể sử dụng cách này, và ở bài viết này mình sẽ hướng dẫn bạn sử dụng một công cụ là Speedtest CLI để kiểm tra tốc độ. Đây là một tools được viết bằng Python sau khi bạn cài đặt là có thể sử dụng kiểm tra bằng thông bằng command line.
Hướng dẫn cài đặt
Mình sẽ thực hiện cài đặt và test trên VPS sử dụng CentOS 7.
pip / easy_install
$ pip install speedtest-cli
- Hoặc
$ easy_install speedtest-cli
Github
$ pip install git+https://github.com/sivel/speedtest-cli.git
- Hoặc
$ git clone https://github.com/sivel/speedtest-cli.git $ cd speedtest-cli $ python setup.py install
Sử dụng
Bạn nhập lệnh speedtest-cli -h
để xem gợi ý và chú thích các tập lệnh.
[root@sv speedtest-cli]# speedtest-cli -h usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes] [--share] [--simple] [--csv] [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json] [--list] [--server SERVER] [--exclude EXCLUDE] [--mini MINI] [--source SOURCE] [--timeout TIMEOUT] [--secure] [--no-pre-allocate] [--version] Command line interface for testing internet bandwidth using speedtest.net. -------------------------------------------------------------------------- https://github.com/sivel/speedtest-cli optional arguments: -h, --help show this help message and exit --no-download Do not perform download test --no-upload Do not perform upload test --single Only use a single connection instead of multiple. This simulates a typical file transfer. --bytes Display values in bytes instead of bits. Does not affect the image generated by --share, nor output from --json or --csv --share Generate and provide a URL to the speedtest.net share results image, not displayed with --csv --simple Suppress verbose output, only show basic information --csv Suppress verbose output, only show basic information in CSV format. Speeds listed in bit/s and not affected by --bytes --csv-delimiter CSV_DELIMITER Single character delimiter to use in CSV output. Default "," --csv-header Print CSV headers --json Suppress verbose output, only show basic information in JSON format. Speeds listed in bit/s and not affected by --bytes --list Display a list of speedtest.net servers sorted by distance --server SERVER Specify a server ID to test against. Can be supplied multiple times --exclude EXCLUDE Exclude a server from selection. Can be supplied multiple times --mini MINI URL of the Speedtest Mini server --source SOURCE Source IP address to bind to --timeout TIMEOUT HTTP timeout in seconds. Default 10 --secure Use HTTPS instead of HTTP when communicating with speedtest.net operated servers --no-pre-allocate Do not pre allocate upload data. Pre allocation is enabled by default to improve upload performance. To support systems with insufficient memory, use this option to avoid a MemoryError --version Show the version number and exit [root@sv speedtest-cli]#
Test tốc độ kết nối Internet với speedtest-cli
$ speedtest-cli
Khi bạn sử dụng lệnh speedtest-cli
script sẽ tự động tìm và kết nối đến server gần nhất và đưa ra kết quả upload/download cho bạn như ảnh bên dưới
Nếu bạn muốn share ra kết quả bạn hãy thêm option --share
$ speedtest-cli --share
Để xem danh sách các server trên thế giới bạn hãy sử dụng option --list
để list ra nhé
$ speedtest-cli --list
Sau khi đã có danh sách các server và ID tương tứng, bạn có thể kiểm tra tốc độ bằng cách sử dụng option --server
ID như sau
$ speedtest-cli --server ID
- VD: Mình test thử với ID 10196 đây là server ở Ấn độ để xem tốc độ ra quốc tế như thế nào
$ speedtest-cli --server 10196
Với bài viết này mong rằng sẽ giúp bạn chọn được một đơn vị cung cấp có máy chủ server với tốc độ trong và ngoài nước tốt cho bạn.