Make squid to mark cache hits and misses (rpm package for Fedora 5)

Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.

squid logoSquid is a proxy server and web cache daemon. It has a wide variety of uses, from speeding up a web server by caching repeated requests, to caching web, DNS and other computer network lookups for a group of people sharing network resources, to aiding security by filtering traffic. Although primarily used for HTTP and FTP, Squid includes limited support for several other protocols including TLS, SSL, Internet Gopher and HTTPS.

When the cache client (like web browser) wishes to access a data presumably in the backing store, it first checks the cache. If an entry can be found with a tag matching that of the desired datum, the datum in the entry is used instead. This situation is known as a cache hit. The alternative situation, when the cache is consulted and found not to contain a datum with the desired tag, is known as a cache miss. More information about cache misses and cache hits is available here.

The common reason to mark cache misses and hits is to control bandwidth of these kinds of traffic. For example: there is a server running squid that caches requests sent by subscribers and it’s necessary to shape bandwidth of traffic retreived directly from original servers (misses) and traffic that comes with local cache (hits). Standard squid versions don't allow this.

But here is patched Squid version (rpm package for Fedora Core 5) that marks misses and hits with different TOS flags: squid-2.5.STABLE-2.FC5.patched.i386.rpm

In case you run this version of squid it’s possible to mark hits by simple iptables command:

iptables -t mangle -A POSTROUTING -o eth1 -p tcp --sport 8080 -m tos --tos 0x0 -j MARK --set-mark 0x1
where eth1 is LAN network interface hardware name, 8080 is tcp port squid is listening at. Therefore all other traffic with source port 8080, output interface eth1 but with TOS flag different from 0x0 can be classified as misses.

Further information on how to follow marked packets to traffic shaping disciplines like HTB or CBQ is available at lartc.org.

P.S. It’s really working for me. Tested.

Information Improvisation: Traffic Engineering Server is Bandwidth Management and QoS Solution that is especially suitable for Broadband ISPs and SMEs.

Share This
 
 
» You might also be interested in the following articles:
Create .deb or .rpm from .tar.gz with checkinstall
Simple Firefox optimizations that really matter
How to restart/stop/start networking in FreeBSD
Prevent Fedora Core yum hang up
Future plans for Ubuntu 9.04 (Jaunty Jackalope)



» Want to stay up to date? Subscribe to our E-MAIL or RSS feed!


1 Response to “Make squid to mark cache hits and misses (rpm package for Fedora 5)”


  1. 1 fluffigt.com » Blog Archive » FAQ: Iptables rules on timely basis

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word




Friendly Sites:Who is behind Linux Screw?
Aspiring Sysadmin | GeekyBits³ | Bash Cures Cancer | TOTMS
Linux Operating System | Small Linux Deployments | My SysAd Blog
The Danesh Project | ZEPY | LinuxHaxor.net | Planet Sysadmin
The Sys Admin | {buhay sysad} | a non-geek's linux notes
CyberCapital.Org | G-LOADED! | The Linux Alternative Project
My name is Artem Nosulchik (artiomix AT gmail DOT com) and I'm Linux/Unix, Cisco systems engineer. The main idea of Linux Screw is to share relevant knowledge, skills and observations over The Web. Here you can find a lot of information related to different Linux distributions, FreeBSD, IOS as well as a other Open Source around staff. Read more ››