Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-16-2008, 09:46 AM   #1
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Rep: Reputation: 18
Unhappy How does transparent cache works?


I would like to know how exactly does Squid does its transparent caching:

What I understand it does is:
When a user in a lan accesses a website, squid receives the request as a server from the browser (client) and as a client request the website from the server the website is hosted on. Then, receives the website as a client from the server and serves the web page to the browser as the a server saving on disk the served page. Now, when another user on the lan request the same page, squid serves it from its cache instead of requesting it again from the internet and as a result saving bandwidth. Is this correct?

I have a transparent cache installed but, I don't think is working that way. I tested by going to lets say from one pc and then from another going to the same site to see if that page got cached but instead it requested from the actual server the page is hosted in.

I ran iptables -L -vn --line-numbers to see how many packets were forwarded where and I got this:

Squid server running in on eth2 of the router
Lan is in on eth1 or router
Internet is on eth0

11 30 1386 ACCEPT tcp -- eth1 eth2 tcp spts:1024:65535 dpt:3128 state NEW


56 31 1395 ACCEPT tcp -- eth2 eth0 tcp spts:1024:65535 dpt:80 state NEW

By looking at that I noticed that the same requests are being downloaded from the internet. Please let me know if this is correct or not.

Thank you.
Old 10-16-2008, 12:54 PM   #2
Senior Member
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,402
Blog Entries: 1

Rep: Reputation: 64
yes, it is the general idea. (besides transparent means you don't need to specify a proxy address/port in browser config - transparent means the browser will use the default gateway address and the proxy running at the gateway will intercept request for port 80/http)

Anyway, the problem is "when another user on the lan request the same page".
Nodays, every site use cookies that are embbebed in the url, so access for the same site from different users may lead to different url to the site, and it is not cached.

Even so, a request is made just to check what is the current version of the page and if it is obsolete, a new page is reloaded from the site.

Bandwidth you generally save, comes from images, backgrounds and other static elements in the page. Sites that make intensive use of ajax and other dynamic elements may have small benefit from cached pages.

Squid has a "Squid Cache analysis" tool (if I am not wrong it is cachemgr.cgi - i am not sure) that can help you to setup your cache by specifying sizes and types of objects it will put in the cache.

I think iptables is not the best tool to debug your squid/cache access.
Old 10-16-2008, 02:21 PM   #3
Registered: Sep 2008
Location: Dominican Republic
Distribution: Debian
Posts: 188

Original Poster
Rep: Reputation: 18
Thank you very much marozsas. I was somewhat worried I didn't have squid working properly. I will read about cachemgr so, I can put it to work.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
openSUSE 10: Samba failed to create the cache directory in /var/cache mianmajidali Linux - Server 0 05-09-2008 03:00 AM
Transparent squid works as normal proxy - help please Ronin_tekorei Fedora 2 01-07-2008 12:12 AM
DNS Error - Works fine but won't cache! Darvocet Linux - Software 0 07-10-2005 02:27 PM
Transparent PNGs show up as transparent in Firefox - opaque in IE? vharishankar General 10 01-11-2005 07:54 AM
how cache works in w web-browser gajaykrishnan Linux - Networking 4 08-13-2004 01:48 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:35 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration