Difference between revisions of "Benchmark: Mengukur packet per second"
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 36: | Line 36: | ||
time hping3 192.168.100.101 -q -i u20 --icmp|tail -n10 | time hping3 192.168.100.101 -q -i u20 --icmp|tail -n10 | ||
− | + | Ini akan mem-bombardir mesin “192.168.100.101” dengan ICMP echo request. Setelah beberapa detik, kita dapat meng-interupsi proses ping dengan menekan tombol CTRL+C. Outputnya kira-kira: | |
--- 192.168.100.101 hping statistic --- | --- 192.168.100.101 hping statistic --- |
Revision as of 06:55, 10 December 2018
Sumber: https://blog.famzah.net/2009/11/24/benchmark-the-packets-per-second-performance-of-a-network-device/
Artikel ini menjelaskan tentang teknik mengukur throughput dan kinerja jaringan dari sebuah komputer Linux, dengan cara perkiraan.
Ada banyak tolok ukur kinerja jaringan dan stress-test yang mengukur tingkat transfer bandwidth maksimum perangkat - yaitu berapa banyak byte per detik atau bit per detik yang dapat ditangani perangkat. Contoh bagus untuk benchmark test semacam ini adalah NetPerf, Iperf, atau bahkan beberapa unduhan wget yang berjalan secara bersamaan dan menyimpan file yang diunduh ke /dev/null, sehingga kita menghilangkan throughput hard disk dari komputer lokal.
Ada metrik lain yang sangat penting untuk throughput perangkat jaringan - rate maksimum paket per detik (pps).
Karena sulitnya menemukan tool yang sesuai untuk mengukur paket per detik dari perangkat jaringan. Pada kesempatan ini akan di perlihatkan dua (2) metoda untuk mengukur menggunakan echo ICMP yang biasa dikenal sebagai "ping", untuk memperkirakan paket per detik dari perangkat jaringan yang langsung terhubung ke jaringan.
Method #1: The old-school “ping“
Jalankan sebagai root:
ping -q -s 1 -f 192.168.100.101
Perintah di atas akan membanjiri tujuan “192.168.100.101” dengan paket PING yang paling kecil. Hasilnya kira-kira,
--- 192.168.100.101 ping statistics --- 20551 packets transmitted, 20551 received, 0% packet loss, time 6732ms
Maka packets-per-second rate di peroleh dengan membagi jumlah paket dengan waktu yang dibutuhkan:
20551 packets / 6.732 secs ~= 3052 packets-per-second
Perlu di catat bahwa ini hanya menghitung "reply" saat 0% packet loss. Artinya jika kita masukan count request ke dalamnya maka hasil akhirnya adalah:
3052 x 2 = 6104 packets-per-second
Catatan: jika kita dapat menjalankan multiple ping sekaligus, maka kita akan dapat memperoleh hasil yang lebih akurat. Kita perlu menjumlahkan rata-rata yang di peroleh dari masing-masing ping, untuk memperoleh packet-per-second rate yang sesungguhnya. Contoh dalam kasus ini, jika kita menjalankan 2 atau 3 ping sekaligus, maka akan memperoleh nilai paket-per-second rata-rata sekitar 8000.
Method #2: The much faster and extended “hping3“
Jalankan perintah berikut
time hping3 192.168.100.101 -q -i u20 --icmp|tail -n10
Ini akan mem-bombardir mesin “192.168.100.101” dengan ICMP echo request. Setelah beberapa detik, kita dapat meng-interupsi proses ping dengan menekan tombol CTRL+C. Outputnya kira-kira:
--- 192.168.100.101 hping statistic --- 67932 packets transmitted, 10818 packets received, 85% packet loss round-trip min/avg/max = 0.5/7.8/15.6 ms
real 0m2.635s user 0m0.368s sys 0m1.160s
If the packet loss is 0%, decrease “-i u20” to something smaller like “-i u15” or less. Make sure to not decrease it too much, or you may temporarily lose connectivity to the device (because of switch problems?).
The calculations for the packets-per-second value are the same as for “ping” above. You need to divide the received packets to the time:
10818 packets / 2.635 secs ~= 4105 packets-per-second
Because the calculated packets-per-second represent the rate of successful replies, we need to multiply it by two, in order to get the actual packets-per-second, as the count of the replies is the same as the count of the successfully received requests. The final result is:
4105 x 2 = 8210 packets-per-second
The calculated value by “hping3” is the same as the one by “ping”. We are either correct, or both methods failed…🙂
Some notes which apply for both methods:
- You should run multiple instances of the ping commands, either from the same or from different machines, in order to be able to properly saturate the connection of the machine which is being tested.
- The machines from which you test have a hardware rate limit too. If the host being tested has a similar rate limit, you surely need to run the ping commands from more than a single machine.
- You should run more and more simultaneous ping commands until you start to receive similar results for the calculated packets-per-second rate. This indicates a saturation of the network bandwidth, usually at the remote host which is being tested, but may also indicate a saturation somewhere in the route between your tester machines and the tested host…
- The ethernet switches also have a hardware limit of the bandwidth and the packets-per-second. This may influence the overall results.
- If the tested device has any firewall rules, you should temporarily remove them, because they may slow down the packets processing.
- If the tested device is a Linux box, you should temporarily remove the ICMP rate limits by executing “sysctl net.ipv4.icmp_ratelimit=0” and “sysctl net.ipv4.icmp_ratemask=0”.
- If the tested device is a router, a better way to test its packets-per-second maximum rate is to flood one of its interfaces and count the output rate at the other one, assuming that you are actually flooding a host which is behind the router according to its routing tables.