Bandwidth Management System - Case Study

736 views

Published on

explain a case study of a Bandwidth Management System implementation in IMTelkom (http://www.imtelkom.ac.id) using FreeBSD

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
736
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
40
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Bandwidth Management System - Case Study

  1. 1. BMS (Bandwidth Management System) Akses Internet Nyoman Bogi Nurul Fitria
  2. 2. Apa itu BMS ? BMS (Bandwidth Management System) adalah suatu sistem untuk mengontrol penggunaan bandwidth agar efisien. Mengapa perlu BMS ? Bandwidth sebagai suatu resource yang tidak tak terbatas dan tidak free, penggunaannya perlu dikontrol karena tingkat kepentingan suatu trafik dan user berbeda-beda. Apa yang bisa dilakukan BMS ? <ul><li>membagi bandwidth berdasarkan IP address user </li></ul><ul><li>membagi bandwidth berdasarkan port aplikasi </li></ul><ul><li>meminjamkan idle bandwidth ke user/aplikasi yang lain </li></ul><ul><li>mengantrikan trafik saat peak time sesuai prioritasnya </li></ul>
  3. 3. Mengapa IM Telkom perlu BMS ? <ul><li>Ada beberapa alasan mengapa BMS dibutuhkan di IM Telkom: </li></ul><ul><li>Pimpinan dan dosen/staf membutuhkan jaminan bandwidth saat jam kerja </li></ul><ul><li>Mahasiswa dapat menggunakan idle bandwidth diluar jam kerja pimpinan/dosen/staf </li></ul><ul><li>Dengan banyaknya aplikasi download, user yang menggunakan aplikasi download ini dapat merebut jatah bandwidth sebanyak banyaknya dan tidak terkontrol. Adanya BMS, sistem antrian menyebabkan setiap user dalam kelas yg sama akan mendapat jatah bandwidth yg sama </li></ul><ul><li>Pengontrolan port aplikasi akan dapat mengatur penggunaan streaming multimedia </li></ul>
  4. 4. Implementasi BMS di IM Telkom Pendahuluan BMS diimplementasikan pada link Internet karena sifatnya yang terbatas (hanya 2Mbps) namun memiliki utilitas yang sangat tinggi (semua user ingin koneksi ke Internet). Di IM Telkom agar dapat terkoneksi ke Internet, user harus terlebih dahulu login menggunakan VPN (autentikasi user) dan selanjutnya menggunakan proxy (accounting dan web caching) untuk dapat browsing ke Internet, maka implementasi BMS harus disesuaikan dengan kondisi tersebut.
  5. 5. Implementasi BMS di IM Telkom Diagram Blok
  6. 6. Analisa BMS di IM Telkom Skenario 1. Pengujian bandwidth untuk masing masing kelas Skenario X.1.1 Kelas1  download Kelas 2 + Kelas 3  idle Skenario X.1.2 Kelas 2  download Kelas 1 + Kelas 3  idle Skenario X.1.3 Kelas 1 + kelas 2  idle Kelas 3  download 2. Pengujian proses peminjaman bandwidth Skenario X.2.1 Kelas 1  idle Kelas 2 + Kelas 3  download Skenario X.2.2 Kelas 2  idle Kelas 1 + kelas 3  download Skenario X.2.3 Kelas 3  idle Kelas 1 + kelas 2  download Skenario X.2.4 Kelas 1 + Kelas 2 + Kelas 3  download 3. SQUID (Skenario A.3) Pengaruh ke jumlah Hit / Miss di access.log. 4. Processor dan memory server (Skenario A.4) Analisa jumlah proses yang ada disistem, status penggunaan CPU, dan status penggunaan memory.
  7. 7. Analisa BMS di IM Telkom Analisa Trafik Gambar 4.1 Trafik Pimpinan Gambar 4.2 Trafik Pegawai Gambar 4.3 Trafik Mahasiswa
  8. 8. Analisa BMS di IM Telkom Analisa Trafik Gambar 4.4 Trafik Pimpinan untuk proses peminjaman bandwidth Gambar 4.5 Trafik Pegawai untuk proses peminjaman bandwidth Gambar 4.6 Trafik Mahasiswa untuk proses peminjaman bandwidth
  9. 9. Analisa BMS di IM Telkom Analisa System Gambar 4.7. Grafik Persentase Hit suatu object ada di web cache Gambar 4.9. Grafik Persentase utilitas CPU Total dan utilitas SQUID di server Gambar 4.8. Grafik Jumlah Proses yang running di server Gambar 4.10. Grafik Persentase Utilitas Memory di server
  10. 10. Kesimpulan <ul><li>Dengan bandwidth management CBQ , besar bandwidth untuk masing masing kelas dapat terbagikan. Artinya dalam men- download file masing masing kelas tidak saling berebutan pemakaian bandwidthnya. </li></ul><ul><li>Begitu juga dengan proses peminjaman bandwidth , CBQ mampu melakukannya. Besar bandwidth dari kelas yang idle, dapat dipinjamkan sementara oleh kelas lainnya. </li></ul><ul><li>Penerapan Bandwidth management ini tidak berpengaruh terhadap : </li></ul><ul><ul><ul><li>jumlah Hit/Miss di access.log proxy server </li></ul></ul></ul><ul><ul><ul><li>jumlah proses server yang running di server </li></ul></ul></ul><ul><ul><ul><li>persentase utilitas memory di server </li></ul></ul></ul>
  11. 11. Lampiran /etc/pf.conf ext_if = &quot;fxp0“ altq on $ext_if cbq bandwidth 10240Kb queue { deflt, bms } queue deflt bandwidth 80% cbq(default) queue bms bandwidth 20% cbq(borrow red) { pimpinan , staf , mahasiswa } queue pimpinan bandwidth 12.5% priority 1 cbq(borrow red) queue staf bandwidth 25% priority 2 cbq(borrow red) queue mahasiswa bandwidth 62.5% priority 3 cbq(borrow red) pass in on $ext_if inet proto tcp from 172.16.1.0/24 to 172.16.1.1 port 8080 keep state queue pimpinan pass in on $ext_if inet proto tcp from 172.16.5.0/24 to 172.16.1.1 port 8080 keep state queue staf pass in on $ext_if inet proto tcp from 172.16.10.0/21 to 172.16.1.1 port 8080 keep state queue mahasiswa pass in on $ext_if inet proto tcp from 172.16.16.0/20 to 172.16.1.1 port 8080 keep state queue mahasiswa pass out on $ext_if inet proto tcp from any to any keep state pass in on $ext_if inet proto tcp from any to any keep state pass out on $ext_if inet all keep statepass in on $ext_if inet proto tcp from 172.16.3.0/24 to 172.16.1.1 port 8080 keep state queue mahasiswa pass out on $ext_if inet proto tcp from any to any port 22 keep state pass in on $ext_if inet proto tcp from any to any port 22 keep state pass out on $ext_if inet all keep state
  12. 12. Lampiran crontab */5 * * * * /root/update_traffic_counter.sh */5 * * * * /root/update_system_status.sh Keterangan : system menjalankan program shell script tersebut secara otomatis setiap 5 menit sekali
  13. 13. Lampiran Script update_system_status.sh #!/bin/sh /usr/bin/top -u -d1 > ./top1.txt /usr/bin/top -u -d2 > ./top2.txt PROCESS=`/bin/cat ./top1.txt | /usr/bin/grep 'processes' | /usr/bin/awk '{print $1}'` CPU=`/bin/cat ./top2.txt | /usr/bin/grep 'CPU states' | /usr/bin/awk '{print $11}'` MEM_A=`/bin/cat ./top1.txt | /usr/bin/grep 'Mem' | /usr/bin/awk '{print $2}'` MEM_I=`/bin/cat ./top1.txt | /usr/bin/grep 'Mem' | /usr/bin/awk '{print $4}'` MEM_W=`/bin/cat ./top1.txt | /usr/bin/grep 'Mem' | /usr/bin/awk '{print $6}'` MEM_C=`/bin/cat ./top1.txt | /usr/bin/grep 'Mem' | /usr/bin/awk '{print $8}'` MEM_B=`/bin/cat ./top1.txt | /usr/bin/grep 'Mem' | /usr/bin/awk '{print $10}'` MYSQLD=`/bin/cat ./top1.txt | /usr/bin/grep 'mysqld' | /usr/bin/awk '{print $10}'` SQUID=`/bin/cat ./top1.txt | /usr/bin/grep 'squid' | /usr/bin/awk '{print $10}'` MPD=`/bin/cat ./top1.txt | /usr/bin/grep 'mpd' | /usr/bin/grep -v 'snmpd' | /usr/bin/awk '{print $10}'` HTTPD=`/bin/cat ./top1.txt | /usr/bin/grep 'httpd' |/usr/bin/awk '{print $10}'` VPN=`/sbin/ifconfig | /usr/bin/grep -c '172.16'` TODAY=`date &quot;+%Y%m%d%H%M&quot;` /usr/local/bin/mysql -u user -ppassword -Dstatus --execute=&quot;insert into system_status set time=${TODAY},process='${PROCESS}',cpu='${CPU}', mem='${MEM_A}',mem_inact='${MEM_I}',mem_wired='${MEM_W}',mem_cache='${MEM_C}',mem_buf='${MEM_B}',mysqld=left('${MYSQLD}', locate('%','${MYSQLD}')),squid=left('${SQUID}',locate('%','${SQUID}')),mpd=left('${MPD}',locate('%','${MPD}')),httpd=left('${HTTPD}', locate('%','${HTTPD}')),vpn='${VPN}'&quot; /usr/local/bin/php /root/cpu.php /usr/local/bin/php /root/memory.php /usr/local/bin/php /root/service.php /usr/local/bin/php /root/vpn.php
  14. 14. Lampiran Script graph.php (part 1) <?php function graph() { $arg=func_num_args();$filename=func_get_arg(0);$x=func_get_arg(1); if ($arg>=3) $y1=func_get_arg(2);if ($arg>=4) $y2=func_get_arg(3);if ($arg>=5) $y3=func_get_arg(4); if ($arg>=6) $y4=func_get_arg(5);if ($arg>=7) $y5=func_get_arg(6); $total_data_x=count($x)-1; $total_data_y=count($y1)-1; if ($total_data_x!=$total_data_y) {return (&quot;number of x values must be the same with y values&quot;);} $total_data=$total_data_x; header(&quot;Content-type: image/png&quot;); $imgWidth=600; $imgHeight=170; $image=imagecreate($imgWidth, $imgHeight); $colorWhite=imagecolorallocate($image, 255, 255, 255);$colorGrey=imagecolorallocate($image, 220, 220, 220); $colorBlack=imagecolorallocate($image, 0, 0, 0);$colorDarkBlue=imagecolorallocate($image, 0, 0, 196); $colorLightBlue=imagecolorallocate($image, 184, 212, 250);$colorRed=imagecolorallocate($image, 255, 0, 0); $colorGreen=imagecolorallocate($image, 0, 196, 0);$colorYellow=imagecolorallocate($image, 200, 200, 0); $colorMagenta=imagecolorallocate($image, 0, 200, 200); $offset_x=50; $offset_y=40; imagefilledrectangle($image, $offset_x, $offset_y, $offset_x+440, $offset_y+100, $colorWhite); $interval=floor(440/$total_data); $j=0; for ($i=1; $i<=$total_data; $i++){ if (!strcmp(substr($x[$i],10,2),&quot;00&quot;)) { imagedashedline($image, $offset_x+($i*$interval), $offset_y+4, $offset_x+($i*$interval), $offset_y+96, $colorGrey); $j=$j+1; if (($j%2)==1) { imagestringup($image, 1, $offset_x+($i*$interval)-3, $offset_y+125, substr($x[$i],8,2).'.00', $colorBlack); } } }
  15. 15. Lampiran Script graph.php (part 2) $max_y=0; for ($i=1; $i<=$total_data; $i++){ if ($arg>=3) if ($max_y<$y1[$i]) {$max_y=$y1[$i];} if ($arg>=4) if ($max_y<$y2[$i]) {$max_y=$y2[$i];} if ($arg>=5) if ($max_y<$y3[$i]) {$max_y=$y3[$i];} if ($arg>=6) if ($max_y<$y4[$i]) {$max_y=$y4[$i];} if ($arg>=7) if ($max_y<$y5[$i]) {$max_y=$y5[$i];} } $max_y=ceil($max_y/25)*25; if ($max_y==0) $max_y=100; for ($i=1; $i<4; $i++){ imageline($image, $offset_x+4, $offset_y+($i*100/4), $offset_x+436, $offset_y+($i*100/4), $colorGrey); } imagestring($image, 1, $offset_x-10, 138, 0, $colorBlack); imagestring($image, 1, $offset_x-15, 88, $max_y/2, $colorBlack); imagestring($image, 1, $offset_x-20, 38, $max_y, $colorBlack); imagestring($image, 3, $offset_x, $offset_y-30, $x[0], $colorBlack); if ($arg>=3) { for ($i=2; $i<=$total_data; $i++) imageline($image, $offset_x+($i*$interval), $offset_y+100-round($y1[$i]/$max_y*100), $offset_x+(($i-1)*$interval),$offset_y+100-round($y1[$i-1]/$max_y*100), $colorRed); imagefilledrectangle($image, $offset_x+450, $offset_y+10, $offset_x+455, $offset_y+15, $colorRed); imagestring($image, 1, $offset_x+460, $offset_y+9, $y1[0], $colorBlack); } if ($arg>=4) { for ($i=2; $i<=$total_data; $i++) imageline($image, $offset_x+($i*$interval), $offset_y+100-round($y2[$i]/$max_y*100), $offset_x+(($i-1)*$interval),$offset_y+100-round($y2[$i-1]/$max_y*100), $colorGreen); imagefilledrectangle($image, $offset_x+450, $offset_y+25, $offset_x+455, $offset_y+30, $colorGreen); imagestring($image, 1, $offset_x+460, $offset_y+24, $y2[0], $colorBlack); }
  16. 16. Lampiran Script graph.php (part 3) if ($arg>=5) { for ($i=2; $i<=$total_data; $i++) imageline($image, $offset_x+($i*$interval), $offset_y+100-round($y3[$i]/$max_y*100), $offset_x+(($i-1)*$interval),$offset_y+100-round($y3[$i-1]/$max_y*100), $colorDarkBlue); imagefilledrectangle($image, $offset_x+450, $offset_y+40, $offset_x+455, $offset_y+45, $colorDarkBlue); imagestring($image, 1, $offset_x+460, $offset_y+39, $y3[0], $colorBlack); } if ($arg>=6) { for ($i=2; $i<=$total_data; $i++) imageline($image, $offset_x+($i*$interval), $offset_y+100-round($y4[$i]/$max_y*100), $offset_x+(($i-1)*$interval),$offset_y+100-round($y4[$i-1]/$max_y*100), $colorYellow); imagefilledrectangle($image, $offset_x+450, $offset_y+55, $offset_x+455, $offset_y+60, $colorYellow); imagestring($image, 1, $offset_x+460, $offset_y+54, $y4[0], $colorBlack); } if ($arg>=7) { for ($i=2; $i<=$total_data; $i++) imageline($image, $offset_x+($i*$interval), $offset_y+100-round($y5[$i]/$max_y*100), $offset_x+(($i-1)*$interval),$offset_y+100-round($y5[$i-1]/$max_y*100), $colorMagenta); imagefilledrectangle($image, $offset_x+450, $offset_y+70, $offset_x+455, $offset_y+75, $colorMagenta); imagestring($image, 1, $offset_x+460, $offset_y+69, $y5[0], $colorBlack); } imagepng($image, $filename); imagedestroy($img); imagedestroy($image); } ?>
  17. 17. Lampiran Script mem.php <?php include(&quot;graph.php&quot;); $link=mysql_connect(&quot;localhost&quot;,“user&quot;,“password&quot;); $result=mysql_query(&quot;select count(*) from status.system_status&quot;,$link); $jml_data=mysql_fetch_row($result);mysql_free_result($result); $jml_data[0]=$jml_data[0]-440; $result1=mysql_query(&quot;select time,mem,mem_inact,mem_wired,mem_cache,mem_buf from status.system_status order by nomor asc limit $jml_data[0],440&quot;,$link); $x=array(0); $x[0] ='Persentase Utilitas Memory'; $y1=array(0);$y1[0]='Active Memory'; $y2=array(0);$y2[0]='Inactive Memory'; $y3=array(0);$y3[0]='Wired Memory'; $y4=array(0);$y4[0]='Cache Memory'; $y5=array(0);$y5[0]='Buffer Memory'; $max_mem=2500; for ($i=1; $i<=440; $i++){ $row=mysql_fetch_row($result1); $x[]=$row[0]; $y1[]=floor(100*$row[1]/$max_mem); $y2[]=floor(100*$row[2]/$max_mem); $y3[]=floor(100*$row[3]/$max_mem); $y4[]=floor(100*$row[4]/$max_mem); $y5[]=floor(100*$row[5]/$max_mem); } mysql_close($link);mysql_free_result($result1);$filename=&quot;memory.png&quot;; graph($filename,$x,$y1,$y2,$y3,$y4,$y5); ?>
  18. 18. Lampiran Script cpu.php <?php include(&quot;graph.php&quot;); $link=mysql_connect(&quot;localhost&quot;,“user&quot;,“password&quot;); $result=mysql_query(&quot;select count(*) from status.system_status&quot;,$link); $jml_data=mysql_fetch_row($result); mysql_free_result($result); $jml_data[0]=$jml_data[0]-440; $result1=mysql_query(&quot;select time,cpu from status.system_status order by nomor asc limit $jml_data[0],440&quot;,$link); $x=array(0); $x[0] ='Persentase Utilitas CPU'; $y1=array(0);$y1[0]='CPU usage'; for ($i=1; $i<=440; $i++){ $row=mysql_fetch_row($result1); $x[]=$row[0]; $y1[]=100-$row[1]; } mysql_close($link);mysql_free_result($result1); $filename=&quot;cpu.png&quot;; graph($filename,$x,$y1); ?>
  19. 19. Lampiran Script hitmiss.sh #!/bin/sh TODAY=`date &quot;+%Y%m%d%H%M&quot;` SQUID=&quot;/usr/local/sbin/squid&quot; SQUID_OPTION=&quot;-f /usr/local/etc/squid/squid.conf -k rotate&quot; TEMP_FOLDER=&quot;/data/log&quot; /bin/cat /usr/local/squid/logs/access.log.0 | /usr/bin/grep 'MISS' | /usr/bin/awk '{print $3 &quot;t&quot; $5}' > ${TEMP_FOLDER}/usage.txt HIT=`/bin/cat /usr/local/squid/logs/access.log.0 | /usr/bin/grep -c 'HIT'` MISS=`/bin/cat /usr/local/squid/logs/access.log.0 | /usr/bin/grep -c 'MISS'` OTHER=`/bin/cat /usr/local/squid/logs/access.log.0 | /usr/bin/grep -v 'HIT' | /usr/bin/grep -v 'MISS' | /usr/bin/grep -c ''`
  20. 20. http://www.imtelkom.ac.id

×