VPS giá rẻ của DigitalOcean là một lựa chọn tốt dành cho những ai đang muốn trải nghiệm những phần mềm mới trên server nhằm cải thiện chất lượng dịch vụ của mình, hoặc đơn giản hơn là những bạn sinh viên, những người mới triển khai các dịch vụ mà chưa cần yêu cầu cấu hình server quá cao. Để giúp các bạn đưa ra quyết định tốt hơn, xTraffic.pep.vn sẽ đánh giá và kiểm tra chất lượng VPS giá rẻ nhất của DigitalOcean là 5USD/tháng với thông số “1CPU + 512MB RAM + 20GB SSD Disk + 1TB Transfer Bandwidth”
Xem thêm : Hướng dẫn cách đăng ký và tạo VPS tại DigitalOcean
Thông tin gói VPS rẻ nhất của DigitalOcean được đánh giá trong bài này
- RAM : 512 MB Memory
- CPU : 1 Core Processor
- Storage : 20 GB SSD Disk
- Bandwidth : 1TB Transfer
- Datacenter Location : Singapore (ASIA)
- Link chi tiết : https://www.digitalocean.com/pricing/
Kiểm tra thông số phần cứng VPS của DigitalOcean
Kiểm tra thông số CPU của VPS bằng lệnh “lscpu” thì thu được kết quả sau :
# lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 1 On-line CPU(s) list: 0 Thread(s) per core: 1 Core(s) per socket: 1 Socket(s): 1 NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 45 Stepping: 7 CPU MHz: 1999.999 BogoMIPS: 3999.99 Virtualization: VT-x Hypervisor vendor: KVM Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 4096K NUMA node0 CPU(s): 0
Như các bạn thấy CPU VPS có thông số là 1 nhân với tốc độ là 1999.999 MHz
Kiểm tra thông số của nhiều đơn vị phần cứng khác nhau như : CPU, RAM, Hard Disk, usb controllers, network adapters,… bằng lệnh “lshw -short” thì được kết quả sau :
# lshw -short H/W path Device Class Description ============================================ system Bochs /0 bus Motherboard /0/0 memory 96KiB BIOS /0/401 processor Intel(R) Xeon(R) CPU E5-2630L 0 @ 2.00GHz /0/1000 memory 512MiB System Memory /0/1000/0 memory 512MiB DIMM RAM /0/100 bridge 440FX - 82441FX PMC [Natoma] /0/100/1 bridge 82371SB PIIX3 ISA [Natoma/Triton II] /0/100/1.1 storage 82371SB PIIX3 IDE [Natoma/Triton II] /0/100/1.2 bus 82371SB PIIX3 USB [Natoma/Triton II] /0/100/1.2/1 usb1 bus UHCI Host Controller /0/100/1.3 bridge 82371AB/EB/MB PIIX4 ACPI /0/100/2 display GD 5446 /0/100/3 network Virtio network device /0/100/4 network Virtio network device /0/100/5 storage Virtio block device /0/100/6 generic Virtio memory balloon /1 eth0 network Ethernet interface /2 eth1 network Ethernet interface
Kiểm tra phân vùng ổ đĩa bằng lệnh “lsblk” thì được kết quả sau :
[root@xtraffic ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 20G 0 disk └─vda1 252:1 0 20G 0 part / [root@xtraffic ~]#
Như ta thấy là VPS giá rẻ của DigitalOcean đang sử dụng CPU có thông số là Intel(R) Xeon(R) CPU E5-2630L 0 @ 2.00GHz , 512MB RAM và 20GB ổ đĩa cứng, đúng như quảng cáo của DigitalOcean.
Kiểm tra hiệu năng của VPS
Kiểm tra tốc độ truy xuất của ổ cứng SSD bằng lệnh “dd”
Điều đặc biệt mà VPS của DigitalOcean cung cấp là ngoài giá thành rẻ, thì việc sử dụng ổ cứng lưu trữ SSD cũng là điểm nhấn lớn nếu kết hợp với chi phí bạn phải bỏ ra. Việc sử dụng SSD sẽ giúp VPS có tốc độ truy xuất dữ liệu nhanh hơn nhiều lần so với ổ cứng lưu trữ truyền thống, điều này tất nhiên cũng ảnh hưởng đến toàn bộ hiệu năng xử lý của VPS. Theo phương pháp kiểm tra này, nếu ổ cứng thông thường có tốc độ truy xuất dữ liệu khoảng 50MB/s là bình thường, thì ổ cứng SSD phải có tốc độ ít nhất là 100MB/s, bây giờ chúng ta sẽ test 10 lần bằng dòng lệnh “dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync” để kiểm tra tốc độ truy xuất dữ liệu của VPS :
# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync 16384+0 records in 16384+0 records out 1073741824 bytes (1.1 GB) copied, 4.5592 s, 236 MB/s
- Lần 1 : 236MB/s
- Lần 2 : 240MB/s
- Lần 3 : 223MB/s
- Lần 4 : 264MB/s
- Lần 5 : 229MB/s
- Lần 6 : 259MB/s
- Lần 7 : 229MB/s
- Lần 8 : 249MB/s
- Lần 9 : 229MB/s
- Lần 10 : 266MB/s
Như vậy, giá trị trung bình của 10 lần test là 242.4 MB/s, một kết quả tương đối tốt và chỉ có ổ cứng SSD mới có được kết quả như vậy
Kiểm tra hiệu năng VPS bằng “PHP BENCHMARK SCRIPT BY XTRAFFIC.PEP.VN”
-------------------------------------------------------------------------------------------------------------- | PHP BENCHMARK SCRIPT BY XTRAFFIC.PEP.VN | | VERSION 2.0 | | DOWNLOAD HERE : https://bit.ly/php-benchmark-script-by-xtraffic-pep-vn | | Copyright 2014 http://xtraffic.pep.vn , All rights reserved! | -------------------------------------------------------------------------------------------------------------- Start : 2014-12-10 03:27:13 Server : _@_ PHP version : 5.3.3 Platform : Linux Test level : 1 -------------------------------------------------------------------------------------------------------------- CPU TESTED + xtraffic_testcpu_math : 0.27813983 seconds. + xtraffic_testcpu_stringmanipulation : 0.46263099 seconds. + xtraffic_testcpu_hashstring : 0.15739393 seconds. + xtraffic_testcpu_gzipstring : 0.32712388 seconds. + xtraffic_testcpu_loops : 0.16656208 seconds. + xtraffic_testcpu_ifelse : 0.19726205 seconds. + xtraffic_testcpu_synthetic : 0.16849709 seconds. ---------------------------- * Total time : 1.75760985 seconds. -------------------------------------------------------------------------------------------------------------- DATA STORAGE DEVICE (HDD/SSD) TESTED + TEST WRITE : File Size : 20 MB Time : 0.094410610198975 seconds Speed : 211.84 MB/s + TEST READ : File Size : 20 MB Time : 0.0058916091918945 seconds Speed : 3.48 GB/s ---------------------------- * Total time : 0.10030222 seconds. -------------------------------------------------------------------------------------------------------------- MYSQL TESTED + DB CONNECTION TIME : 0.00165105 seconds + TEST INSERT TO DB "10,000 RECORDS" : 3.18339705 seconds + TEST SELECT (1) WITH "10,000 RECORDS" : 1.16020155 seconds + TEST SELECT (2) WITH "10,000 RECORDS" : 1.02183938 seconds + TEST SELECT (3) WITH "10,000 RECORDS" : 1.22570872 seconds + TEST UPDATE WITH "10,000 RECORDS" : 0.18267679 seconds + TEST DELETE WITH "10,000 RECORDS" : 0.35990596 seconds ---------------------------- * Total time : 7.13538051 seconds. -------------------------------------------------------------------------------------------------------------- NETWORK TESTED + Test download speed from "cachefly.cachefly.net" [Location : CDN] Size : 12.89 MB Download Time : 4.867247 sec Speed : 2.65 MB/s + Test download speed from "mirror-fpt-telecom.fpt.net" [Location : Vietnam] Size : 5.13 MB Download Time : 4.987016 sec Speed : 1.03 MB/s + Test download speed from "centos-hcm.viettelidc.com.vn" [Location : Ho Chi Minh, Vietnam] Size : 30.27 MB Download Time : 1.984442 sec Speed : 15.25 MB/s + Test download speed from "centos-hn.viettelidc.com.vn" [Location : Ha Noi, Vietnam] Size : 465 KB Download Time : 4.948382 sec Speed : 94 KB/s + Test download speed from "mirror.nhanhoa.com" [Location : Vietnam] Size : 1.65 MB Download Time : 4.87095 sec Speed : 347 KB/s + Test download speed from "dl.google.com" [Location : Google] Size : 16.58 MB Download Time : 0.319157 sec Speed : 51.95 MB/s + Test download speed from "download.microsoft.com" [Location : Microsoft] Size : 10.69 MB Download Time : 4.792936 sec Speed : 2.23 MB/s + Test download speed from "speedtest.tokyo.linode.com" [Location : Tokyo, Japan] Size : 73.83 MB Download Time : 4.959935 sec Speed : 14.88 MB/s + Test download speed from "speedtest-sgp1.digitalocean.com" [Location : Singapore] Size : 100 MB Download Time : 0.956754 sec Speed : 104.52 MB/s + Test download speed from "ftp.funet.fi" [Location : Finland] Size : 408 KB Download Time : 4.856068 sec Speed : 84 KB/s + Test download speed from "ftp.belnet.be" [Location : Belgium] Size : 884 KB Download Time : 4.777829 sec Speed : 185 KB/s + Test download speed from "ga-us-ping.vultr.com" [Location : Atlanta, Georgia, USA] Size : 3.31 MB Download Time : 4.526783 sec Speed : 749 KB/s + Test download speed from "sjo-ca-us-ping.vultr.com" [Location : Silicon Valley, California, USA] Size : 6.2 MB Download Time : 3.963273 sec Speed : 1.56 MB/s + Test download speed from "nj-us-ping.vultr.com" [Location : New York / New Jersey, USA] Size : 1.5 MB Download Time : 4.317006 sec Speed : 357 KB/s --------------------------------------------------------------------------------------------------------------
Kiểm tra hiệu năng của VPS bằng sysbench
sysbench là phần mềm đánh giá hiệu năng của Server khá tốt và phổ biến. Để sử dụng được sysbench trên VPS của bạn, thì đầu tiên bạn phải cài đặt (nếu chưa có) thông qua lệnh sau :
yum install sysbench
Kiểm tra hiệu năng CPU VPS bằng sysbench
Sau khi cài đặt thành công sysbench, bạn kiểm tra hiệu năng CPU bằng lệnh sau :
sysbench --test=cpu --cpu-max-prime=20000 run
Sau đây là kết quả thực hiện trên VPS giá rẻ của DigitalOcean :
[root@xtraffic ~]# sysbench --test=cpu --cpu-max-prime=20000 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Doing CPU performance benchmark Threads started! Done. Maximum prime number checked in CPU test: 20000 Test execution summary: total time: 37.9961s total number of events: 10000 total time taken by event execution: 37.9910 per-request statistics: min: 3.55ms avg: 3.80ms max: 8.29ms approx. 95 percentile: 3.92ms Threads fairness: events (avg/stddev): 10000.0000/0.00 execution time (avg/stddev): 37.9910/0.00 [root@xtraffic ~]#
Ở đây ta chú ý đến những kết quả sau :
- total time : 37.9961s
- total number of events : 10000
- total time taken by event execution : 37.9910
- min: 3.55ms
- avg: 3.80ms
- max: 8.29ms
- approx. 95 percentile: 3.92ms
Như ta thấy là thời gian xử lý trung bình của 95% sự kiện trên tổng số 10000 sự kiện là 3.92ms, đây là một tốc độ xử lý khá tốt.
Kiểm tra hiệu năng truy xuất dữ liệu ổ cứng của VPS bằng sysbench
Để kiểm tra toàn diện hiệu năng truy xuất dữ liệu ổ cứng của VPS bằng sysbench thì chúng ta sẽ sử dụng các lệnh sau :
Chuẩn bị file test
sysbench --test=fileio --file-total-size=5G prepare
Thực hiện test
sysbench --test=fileio --file-total-size=5G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run
Xoá file test
sysbench --test=fileio --file-total-size=5G cleanup
Và kết quả kiểm tra trên VPS của DigitalOcean như sau :
[root@xtraffic ~]# sysbench --test=fileio --file-total-size=5G prepare sysbench 0.4.12: multi-threaded system evaluation benchmark 128 files, 40960Kb each, 5120Mb total Creating files for the test... [root@xtraffic ~]# sysbench --test=fileio --file-total-size=5G --file-test-mode=rndrw --init-rng=on --max-time=300 --max-requests=0 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 1 Initializing random number generator from timer. Extra file open flags: 0 128 files, 40Mb each 5Gb total file size Block size 16Kb Number of random requests for random IO: 0 Read/Write ratio for combined random IO test: 1.50 Periodic FSYNC enabled, calling fsync() each 100 requests. Calling fsync() at the end of test, Enabled. Using synchronous I/O mode Doing random r/w test Threads started! Time limit exceeded, exiting... Done. Operations performed: 134520 Read, 89680 Write, 286903 Other = 511103 Total Read 2.0526Gb Written 1.3684Gb Total transferred 3.421Gb (11.676Mb/sec) 747.27 Requests/sec executed Test execution summary: total time: 300.0235s total number of events: 224200 total time taken by event execution: 215.0532 per-request statistics: min: 0.00ms avg: 0.96ms max: 79.89ms approx. 95 percentile: 0.87ms Threads fairness: events (avg/stddev): 224200.0000/0.00 execution time (avg/stddev): 215.0532/0.00 [root@xtraffic ~]# sysbench --test=fileio --file-total-size=5G cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Removing test files... [root@xtraffic ~]#
Lưu ý là phương pháp thực hiện test của sysbench khác với khi ta thực hiện lệnh “dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync” nên không thể dùng 2 kết quả của 2 phương pháp khác nhau để so sánh được. Do đó bạn thực hiện phương pháp nào thì phải so sánh kết quả của cùng phương pháp đó trên các VPS khác nhau.
Ở kết quả này ta sẽ chú trọng vào các thông số sau :
Operations performed: 134520 Read, 89680 Write, 286903 Other = 511103 Total Read 2.0526Gb Written 1.3684Gb Total transferred 3.421Gb (11.676Mb/sec) 747.27 Requests/sec executed Test execution summary: total time: 300.0235s total number of events: 224200 total time taken by event execution: 215.0532 per-request statistics: min: 0.00ms avg: 0.96ms max: 79.89ms approx. 95 percentile: 0.87ms
Kiểm tra hiệu năng MySQL trên VPS bằng sysbench
sysbench cũng cung cấp cho ta cách kiểm tra hiệu năng của MySQL khi chạy trên VPS. Tất nhiên để thực hiện được điều này, thì bạn cần phải cài đặt MySQL trên VPS của mình, tạo 1 database để test (ở đây mình tạo database có tên là pep_test) sau đó bạn chạy lệnh sau :
Chuẩn bị data để test
sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD prepare
Thực hiện test
sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run
Dọn sạch dữ liệu test
sysbench --test=oltp --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD cleanup
Và đây là kết quả test trên VPS giá rẻ của DigitalOcean
[root@xtraffic ~]# sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD prepare sysbench 0.4.12: multi-threaded system evaluation benchmark Creating table 'sbtest'... Creating 1000000 records in table 'sbtest'... [root@xtraffic ~]# sysbench --test=oltp --oltp-table-size=1000000 --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD --max-time=60 --oltp-read-only=on --max-requests=0 --num-threads=8 run sysbench 0.4.12: multi-threaded system evaluation benchmark Running the test with following options: Number of threads: 8 Doing OLTP test. Running mixed OLTP test Doing read-only test Using Special distribution (12 iterations, 1 pct of values are returned in 75 pct cases) Using "BEGIN" for starting transactions Using auto_inc on the id column Threads started! Time limit exceeded, exiting... (last message repeated 7 times) Done. OLTP test statistics: queries performed: read: 205170 write: 0 other: 29310 total: 234480 transactions: 14655 (244.21 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 205170 (3418.95 per sec.) other operations: 29310 (488.42 per sec.) Test execution summary: total time: 60.0096s total number of events: 14655 total time taken by event execution: 479.8714 per-request statistics: min: 11.08ms avg: 32.74ms max: 64.44ms approx. 95 percentile: 43.01ms Threads fairness: events (avg/stddev): 1831.8750/15.74 execution time (avg/stddev): 59.9839/0.01 [root@xtraffic ~]# sysbench --test=oltp --db-driver=mysql --mysql-db=pep_test --mysql-user=root --mysql-password=YOUR_MYSQL_ROOT_PASSWORD cleanup sysbench 0.4.12: multi-threaded system evaluation benchmark Dropping table 'sbtest'... Done. [root@xtraffic ~]#
Ở đây, ta sẽ chú ý đến các thông số quan trọng sau :
OLTP test statistics: queries performed: read: 205170 write: 0 other: 29310 total: 234480 transactions: 14655 (244.21 per sec.) deadlocks: 0 (0.00 per sec.) read/write requests: 205170 (3418.95 per sec.) other operations: 29310 (488.42 per sec.) Test execution summary: total time: 60.0096s total number of events: 14655 total time taken by event execution: 479.8714 per-request statistics: min: 11.08ms avg: 32.74ms max: 64.44ms approx. 95 percentile: 43.01ms Threads fairness: events (avg/stddev): 1831.8750/15.74 execution time (avg/stddev): 59.9839/0.01
Kiểm tra tốc độ download file từ VPS
Hiện tại mình đang sử dụng gói cước Internet giá rẻ nhất của MegaVnn (VNPT) là MegaBasic (150.000 VNĐ/tháng), sử dụng trình duyệt Chrome để download file từ VPS của DigitalOcean đặt tại Singapore thì được kết quả là 335KB/s như hình 1 bên dưới ( bạn có thể truy cập vào đây để test thử tốc độ download từ máy của bạn ) :
Nếu bạn đang sử dụng một VPS của nhà cung cấp dịch vụ nào đó, hãy kiểm tra hiệu năng VPS của bạn với hiệu năng VPS giá rẻ nhất của DigitalOcean bằng các phương pháp được trình bày trong bài viết này, từ đó sẽ có những quyết định lựa chọn tốt hơn.