LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

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


Hello.

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 www.bestbuy.com 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 192.168.3.100 on eth2 of the router
Lan is in 192.168.2.0/24 on eth1 or router
Internet is on eth0


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

and..

56 31 1395 ACCEPT tcp -- eth2 eth0 192.168.3.0/24 0.0.0.0/0 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
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,397
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
landysaccount
Member
 
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.
 
  


Reply


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


All times are GMT -5. The time now is 03:48 PM.

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