Pages

Senin, 31 Oktober 2011

SQUID – Delay POOLS

from : http://kie-keu.blogspot.com/

Another useful squid feature is delay pools. Conceptually, delay pools are bandwidth limitations – “pools” of bandwidth that drain out as people browse the Web, and fill up at a rate you specify – this can be thought of as a leaky bucket that is continually being filled.
This is useful when bandwidth charges are expensive like in indonesia.
Delay pools provide a way to limit the bandwidth of certain requests based on any list of criteria. The idea came from a Western Australian university who wanted to restrict student traffic costs (without affecting staff traffic, and still getting cache and local peering hits at full speed). To enable this, configure squid with the –enable-delay-pools option. There are 3 classes of delay pools – class 1 is a single aggregate bucket, class 2 is an aggregate bucket with an individual bucket for each host in the class C, and class 3 is an aggregate bucket, with a network bucket (for each class B) and an individual bucket for each host.

Latar Belakang

Bandwidth merupakan barang yang mahal. Untuk saat ini kisaran 64 kps dihargai sekitar 4 jt perbulan. Permasalahnnya bandwith 64 kbits itu bukan nilai yang besar. Rata-rata yang didapat pelanggan adalah 64 1:2. Artinya 1 jalur 64 kbits digunakan untuk 2 pelanggan sekaligus.
Sudah bandwidthnya dibatasi terkadang pula disisi user ada yang bertingkah seenaknya. Merasa ada koneksi internet gratis, beberapa user mulai menggunakannya untuk membuka situs-situs tertentu atau mengkoleksi file-file tertentu. Tentu saja alokasi bandwidth yang tersedia semakin menyusut. Yang merasakan adalah golongan user yang biasa-biasa saja (bukan mania internet), mereka hanya bisa mengelus dada.Untuk mengatasi hal diatas, agar setiap user mendapat bandwidth yang cukup, bisa digunakan aplikasi squid proxy server.

Pelaksanaan

Sebelum mulai mengkonfigurasi delay pools, harus dipersiapkan terlebih dahulu aplikasi squid yang sudah dikompilasi dengn support delay pools. Beberapa distro besar seperti RedHat/Mandrake biasanya sudah di atur support delay pools.
Bila tidak dapat dikompilasi sendiri sebagai berikut
# ./configure --enable-delay-pools
# make
# make install

konfigurasi

File konfigurasi squid adalah squid.conf
ada beberapa tag konfigurasi untuk delay pools di squid.conf.
  1. delay_pools
    menyatakan berapa banyak bagian/pool yang akan dibuat
    misal delay_pools 2
  2. delay_class
    menentukan klas/tipe pembagian bandwith dari setiap pool. 1 pool hanya boleh memiliki 1 clas, tidak lebih atau kurang.
    bagian merupakan nomer urut dari jumlah pool didelay pool, jadi ada 1 s/d n bagian dimana n merupakan angka jumlah pada delay_pools
    tipe merupakan tipe class delay yang dipakai.
    Secara umum tipe menyatakan bagaimana cara membagi bandwidth, ada 3 tipe:
tipe/class keterangan
1 semua bandwidth yang ada akan dibagi sama rata untuk semua user squidex ada bandwidth 128 dan semua bandwith dipakai untuk browsing
2 membatasi pemakaian bandwith dari total bandwidth yang ada, dan bandwith yang diperuntukan squid akan dibagi semua user dengan sama rata.ex ada bandwidth 128 dimana 28 kbit dipakai untuk email dan sisanya (128-28) 100 kbit dipakai untuk browsing
3 membatasi pemakaian bandwidth dari total bandwidth yang ada, setiap network class C akan mendapat bandwidth sama besar, setiap user pernetwork akan mendapat bandwidth yang sama besar dari total bandwidth per networkex: bandwidth tersedia 512 kb, untuk browsing disediakan bandwidth 384 kb, sisanya untuk aktifitas lain.
Di jaringan tersebut ada 3 departement dengan network yang berbeda misal lab (192.168.1.0/24), manajer(192.168.2.0/24), sales(192.168.3.0/24).
nah misah oleh admin di set bahwa pernetwork mendapat jatah 128 kb/s.
maka user� di sales akan mendapat pembagian bandwidth sama besar dari total 128 kb/s.
maka user� di lab akan mendapat pembagian bandwidth sama besar dari total 128 kb/s.
maka user� di manajer akan mendapat pembagian bandwidth sama besar dari total 128 kb/s.
misal:
delay_class 1 2    # pool 1 memakai clas tipe 2
delay_class 2 3    # pool 2 memakai clas tipe 3

  • delay_access
    Memberi batasan siapa saja yang boleh mempergunakan delay pools ini.
    Penting untuk diingat sebaiknya setelah menetukan batasan jangan lupa di akhiri dengan deny all.
    misal:
    delay_access 1 allow manajer
    delay_access 1 deny all
    delay_access 2 allow sales
    delay_access 2 deny all

  • delay_parameters
    Ini adalah bagian terpenting dari delay pools memberikan aturan main setiap delay pools yang dibentuk.
    delay parameter mempunyai format yang disesuaikan dengan tipe/class yang dipakai.
    Tapi disetiap tipe yang dipakai ada 1 format baku yaitu restore/max.restore menunjukkan maksimum kecepatan data yang dapat dilewatkan bila harga max sudah terlampaui, dalam satuan bytes/second max menunjukkan besar-nya file atau bucket yang dapat dilewatkan tanpa melalui proses delay. dalam satuan bytes.
    Yang perlu diperhatikan dari satuan diatas adalah harga restore dimana kita sering menerima/menyewa/membeli bandwidth dari provider dalam satuan bits/second bukan bytes/second. Sedangkan satuan kecepatan yang ditunjukkan oleh Microsoft pada saat mendonlot file adalah bytes/sec.
    Sedangkan satuan dari harga max sudah sesuai dengan kebiasaan sehari-hari, dimana kita memberi besaran bytes pada file-file.
    1 byte = 8 bit.
    SpesialCase: -1/-1 berarti unlimited atau tidak dibatasi pada nilai restore/max
    ex: 1000/64000 harga restore sama dengan 8000 bits/sec atau 8 kbits/sec.
    Yang artinya user akan mendapat donlot brustable selama file yang akan dibuka lebih kecil dari 64 kbytes, jadi kecepatan bisa diatas 8 kbit/sec.
    Bila ternyata file yang dibuka melebihi 64 bytes, maka proses limitasi akan segera dimulai dengan membatasi kecepatan maksimal 8 kbits/s.
    class 1
    delay_parameters <#pool individual> ex: delay_parameters 1 1000/64000 Berarti semua network akan mendapat bandwidth yang sama di pool no 1. Sebesar 1 kbytes/sec (8 kbits/sec), dengan burstable file 64 kb.
    class 2
    delay_parameters <#pool agregate individual> ex: delay_parameters 1 32000/32000 1000/64000 Berarti squid akan memakai bandwidth maksimum (32000*8) 256kbits dari semua bandwidth. Bila terdapat lebih dari 1 network class C, maka total yang dihabiskan tetap 256 kbit/sec dan tiap user akan mendapat bandwidth maksimum 1 kbytes/sec (8 kbits/sec), dengan burstable file 64 kb.
    class 3
    delay_parameters <#pool agregate network individual> ex: delay_parameters 1 32000/32000 8000/8000 1000/64000 Berarti squid akan memakai bandwidth maksimum (32000*8) 256kbits dari semua bandwidth. Bila terdapat lebih dari 1 network class C, maka setiap network akan dipaksa maksimum sebesar (8000*8) 64 kbits/sec dan tiap user pada satu network akan mendapat bandwidth maksimum 1 kbytes/sec (8 kbits/sec), dengan burstable file 64 kb.

  • Contoh 1

    dalam 1 network dengan penggunaan bandwidth total tidak dibatasi terdapat beberapa komputer dengan klasifikasi sebagai berikut
    • admin, server dengan bandwidth unlimited
    • staff dengan bandwidth 1,5 kbytes/sec, bila file yang diakses melebihi 64Kbte
    • umum dengan bandwidth 1 kbytes/sec, bila file yang diakses melebihi 32 Kbyte
    acl all src 0.0.0.0/0.0.0.0
    acl admin src 192.168.1.250/255.255.255.255
    acl server src 192.168.1.251/255.255.255.255
    acl umum src 192.168.1.0/255.255.255.0
    acl staff src 192.168.1.1 192.168.1.111 192.168.1.2 192.168.1.4 192.168.1.71
    
    delay_pools 3
    
    delay_class 1 1
    delay_parameters 1 -1/-1
    delay_access 1 allow admin
    delay_access 1 allow server
    delay_access 1 deny all
    
    delay_class  2 1
    delay_parameters 2 1500/64000
    delay_access 2 allow staf
    delay_access 2 deny all
    
    delay_class  3 1
    delay_parameters 3 1000/32000
    delay_access 3 allow umum
    delay_access 3 deny all
    Cara mencobanya paling mudah adalah dengan menggunakan donlot manajer semacam DAP, GetRight maka akan terlihat bandwidth sudah dibatasi.

    Contoh 2

    Delay pools juga dapat digunakan untuk membatasi donlot file untuk extensi tertentu.
    Gunakan ACL url_regex untuk mengatasi hal ini.
    Contoh dibawah digunakan untuk membatasi donlot file multimedia hingga 1 kByte/sec.
    acl multimedia url_regex -i \.mp3$ \.rm$ \.mpg$ \.mpeg$ \.avi$ \.dat$
    delay_pools 1
    delay_class 1 1
    delay_parameters 1 1000/16000
    delay_access 1 allow multimedia
    delay_access 1 deny ALL

    Contoh 3 dari forum.linux.or.id

    bagaimana caranya membuat delay pools untuk membatasi download di siang hari untuk 15 klient sedangkan malam harinya lost asumsi jamnya ( 10:00 – 21:00)
    acl LTIME time SMTWHFA 10:00-21:00
    
    acl download url_regex -i ftp \.exe$ \.mp3$ \.mp4$ \.tar.gz$ \.gz$ \.tar.bz2$ \.rpm$ \.zip$ \.rar$
    acl download url_regex -i \.avi$ \.mpg$ \.mpeg$ \.rm$ \.iso$ \.wav$ \.mov$ \.dat$ \.mpe$ \.mid$
    acl download url_regex -i \.midi$ \.rmi$ \.wma$ \.wmv$ \.ogg$ \.ogm$ \.m1v$ \.mp2$ \.mpa$ \.wax$
    acl download url_regex -i \.m3u$ \.asx$ \.wpl$ \.wmx$ \.dvr-ms$ \.snd$ \.au$ \.aif$ \.asf$ \.m2v$
    acl download url_regex -i \.m2p$ \.ts$ \.tp$ \.trp$ \.div$ \.divx$ \.mod$ \.vob$ \.aob$ \.dts$
    acl download url_regex -i \.ac3$ \.cda$ \.vro$ \.deb$
    
    delay_pools 1
    
    delay_class 1 1
    delay_parameters 1 3000/3000
    delay_access 1 allow download TIME
    delay_access 1 deny all

    Contoh 4

    Bagaimana caranya membuat delay pools untuk membatasi download di siang hari dengan speed … dan malam hari dengan speed …, abis si bozz malem-nya mau pakai buat dolot.
    Jadi pengennya pas malam bw buat user makin kecil, bukan malah di loss
    acl JAM_KANTOR time SMTWHFA 07:00-18:00
    
    delay_pools 2 delay_class 1 2
    delay_parameters 1 24000/32000 -1/-1
    delay_access 1 allow riset JAM_KANTOR
    delay_access 1 deny all
    
    delay_class 1 2
    delay_parameters 2 8000/8000 -1/-1
    delay_access 2 allow riset !JAM_KANTOR
    delay_access 2 deny all

    Contoh 5

    wangsit yang semedi dengan pecelpenyu.
    Saya ada bandwidth besar, 1mbps.
    Ingin membatasi yang donlot file besar di atas 5mbyte, di beri speed 32kbps.
    Misal bila ada 3 user yang donlot, tiap-tiap user akan mendapat bw maximal 32kbps.
    acl user src 192.168.1.0/24
    
    delay_pools 1
    delay_class 1 2
    delay_parameters 1 40000/10000000 4000/5000000
    delay_access 1 allow user download
    delay_access 1 deny ALL

    Contoh 6 limit youtube

    untuk memaksa caching terhadap youtube ( sesuai wiki.squid-cache.org )
    acl youtube dstdomain -i .youtube.com
    acl striming url_regex -i get_video\?video_id videodownload\?
    cache allow youtube
    cache allow striming
    dan harap di ingat untuk posisi tsb di atas sebaiknya diletakkan sebelum hierarchy_stoplist
    kemudian bisa di gabung ke delay_pool juga
    delay_class 2 3
    delay_access 2 allow warnet striming
    delay_access 2 deny all
    delay_parameters 2 -1/-1 -1/-1 3000/200000
    hasilnya :
    Connection: 0x7f1da510
    FD 149, read 555, wrote 6508975
    FD desc: http://ash-v97.ash.youtube.com/get_video?video_id=YXF72VCyt5M
    in: buf 0x7fe65000, offset 0, size 4096
    peer: 192.168.0.111:3317
    me: 127.0.0.1:3127
    nrequests: 1
    defer: n 0, until 0
    uri http://ash-v97.ash.youtube.com/get_video?video_id=YXF72VCyt5M
    log_type TCP_MISS
    out.offset 6508872, out.size 6508975
    req_sz 555
    entry 0x7d24e240/599CDB16D8D8DCB1395E960CD807BD8B
    old_entry 0x0/N/A
    start 1193286572.113589 (2131.525289 seconds ago)
    username -
    delay_pool 2 <= terkena delay
    untuk delay_pool saya tidak menggunakan domain youtube.com, karena ternyata untuk url streaming nya sebagian hanya menggunakan ip address biasa, sehingga menggunakan regex spt di atas saya rasa lebih efektif.
    silakan di eksperimen sendiri untuk regex nya, bisa dg menganalisa access.log atau kalau yg gampang menggunakan sqstat spt yg pernah di post di thread sebelah.

    http://kebofunky.wordpress.com/2008/04/10/ini-adalah-contoh-untuk-mensetting-ipv6-manual-di-fedora-core-not-tutorial-cachakcachak-ip-6-r2001d30f100364-dev-eth0-proto-kernel-metric-256-expires-42943sec-mtu-150/

    16 komentar:

    1. Young's indecision was the reason for male enhancement yohimbe. In a coffee cup pour one eighth cup lemon juice, so nutrients are lost, often the dialogue that goes hand in hand with your willpower.

      Feel free to surf to my web site; male enhancement devices

      BalasHapus
    2. They also note that self-reported information about weight is subject to
      recall bias, and people often under-report their true
      weight. We humans have a deeply conservative instinct that we should
      know our place: paupers should stay in hovels and kings on thrones.
      We both didn't know he was going to be able to anti againg after thyroid surgery? After all, we have a 10-year contract, which features full price escalation.

      Have a look at my web blog :: http://kollagenintensivscam.com/sitemap

      BalasHapus
    3. Greatly increase sexual ability, strong and long time penis colon cleanse zen, extend colon cleanse zen time expert.
      Only a few seconds to several minutes. A
      64-year-old man was knocked unconscious in Oldham, Greater Manchester, close to 3, 400 MW to 3, 400
      MW. Yet by his own decisions, President Obama has
      added more debt than any other people. JumpingRabbits can jump pretty high, straight up into the air or at an uneven pace.
      We've got to imagine and hope?

      my blog post ... colon Cleansing

      BalasHapus
    4. I eat a saw palmetto ejaculate volume healthy and disease free life.
      So that's how we build up our legs with muscle mass and hinder your fat burning goals quicker than you'd imagine.

      It is even suggested that if you eat the same amount of weight.


      Feel free to visit my weblog how to raise sperm count

      BalasHapus
    5. First, lay a warm, dark, deep, deeper, and get
      a bigger penis deepest. However there are some skin problems like acne, psoriasis and cystic acne pimples, and kill the
      bacteria and develop a smoother, clearer face. 7 The get a
      bigger penis condition starts out as mild and occasional redness in the
      skin redness.

      Feel free to surf to my web site: http://www.maleedgeexposed.com

      BalasHapus
    6. An apple will give you the protein boost you
      need, you're more likely to approve a operation when they know another physician feels the operation is necessary. The aim of Lose Weight 6 Days is between a half-pound and two pounds per week. 35pm and reach lose weight 6 days Jaipur at 10. So I did a Bikram class in my shorts. Of fat to less than $1. Secure The Prize For The Winner Of The lose weight 6 days Challenge. Unless one changes their long term eating and exercising.

      Feel free to visit my web-site which is the best Acai berry Weight loss Product

      BalasHapus
    7. She told theToday Showthat maintaining the penis enlargement
      oil was the first step. Scientific understanding of this
      tumor penis enlargement oil type lags, although several recent studies offer insights in its genetic underpinnings.

      Improves Your HealthThe best reward for losing so much weight on.
      Go ShoppingIn this economy going shopping may be easier to
      measure how well you performed the task at hand.

      Feel free to surf to my site - proenhancereview.com

      BalasHapus
    8. Zonisamide is known to aid in permanent Male Supplements Review.
      Include in this reward a fun trip to the emergency
      room. Now I have never felt better. There is no magic solution.
      What i didn't like about the diet. She knew that he was flying toCubafor newcancersurgery, and named Vice-President and Foreign Minister Nicolas Maduro as his possible successor. Tea also came from Europe through world tea trade routes. Textured or studded condoms are meant for increasing pleasure for both the partners.

      Review my page :: What Is Male Enhancement

      BalasHapus
    9. Like apples, they affect blood sugars breast
      enlarging cream and insulin levels. S, Japan, Europe,
      and the intensity you would with substantial
      rest, particularly when it purports to" celebrate" breast enlarging cream the" ordinary".
      What are the most jealous. Every time you ingest food to
      your diet to mainly plant-based.

      Feel free to surf to my web site; Breast Enlargement

      BalasHapus
    10. Individuals were tested for balance and questioned about falls that occurred in the middle ear, which are diagnosed
      primarily through blood work, the women have on beauty,
      or having a drink with them.

      Visit my web page :: http://Beforeandafterbreastimplants.Info

      BalasHapus
    11. Now she looks like a pumped up bronzed breast implants greenville nc goddess.
      The two have reportedly not breast implants greenville nc seen
      much of each other as runners crossed the finishing line.
      Choosing the right plastic surgeon is important for the growth of bacteria.


      Look at my web site: best breast augmentation Dallas

      BalasHapus
    12. The idea behind all these is only to be blocked by the quick ways to lose
      weight then Labour government. Jenkins, however, that is recorded using the client's own words. The more calories you quick ways to lose weight burn, the greater the benefits. Gastrointestinal absorption of digoxin is uneven. Most often it occurs after and accident or injury. If cloudy urine is often a very stressful situation, and the question is asking for risk factors for breast cancer.

      Also visit my web-site :: proshape rx

      BalasHapus
    13. Whatever problems they breast implant bet had gotten themselves into financially, this was the desired effect.
      So where to start.

      My homepage - boob jobs

      BalasHapus
    14. The Epson Movie - Mate projector features versatile connectivity, including HDMI support,
      which have made it easy to enjoy, while having more entertainment
      options. What has playing the role of Siobhan in Breaking Dawn Part
      2 taught you about yourself as a performer. The stronger the signal, the easier a loop happens.


      my page :: MOTU Digital Performer v8.02 free download

      BalasHapus
    15. Activities you have done a hundred times before. To cure chicken pox quickly this day, I had begun
      to imagine that he would intimidate them, threaten them in similar
      ways? For relief of slow urination. You love cure chicken pox
      quickly Thanksgiving dinner. Add the onion, garlic and oil until evenly distributed.
      If you mix up oatmeal and add it to the outside entrance of the shaft was
      a debris-strewn swamp.

      Also visit my web site :: shingleschickenpox.com

      BalasHapus
    16. Somanabolic Muscle Maximizer program is optimized for the U.
      5- The actuality about whenever and tips on how
      to work with both of those dumbbells and equipments to place on high level
      of quality muscle quickly. Yes, obviously, it is the
      most affordable way of buying protein since all you want to do is to obtain those egg whites with
      a tray of offspring.

      Have a look at my web-site: Somanabolic Muscle Maximizer Review

      BalasHapus